Answer the question
In order to leave comments, you need to log in
Cron is not running. Server reboot. What am I doing wrong?
Good afternoon.
The server has CentOS release 6.7 (Final) installed. With Linux I encounter for the first time, zero knowledge. All at the level of "google" and logic. Therefore, I ask for advice:
The task is banal: it is necessary to restart the server every day at 07:00.
Done:
1. Created a script along the way
etc/scripts/shoutdown.sh
shoutdown -r now
0 7 * * * /etc/scripts/shoutdown.sh
/var/spool/cron
sh /etc/scriptpts/shoutdown.sh
Answer the question
In order to leave comments, you need to log in
Either the script must be run explicitly by specifying in crontab /bin/sh /etc/scripts/shoutdown.sh
, or the first line of the script must be an indication of the program that processes the script#!/bin/sh
Something and somewhere you messed up with the scripts.
You don't need a script for this, just write in the crontab:
0 7 * * * /sbin/shutdown -r now
sudo crontab -e
0 7 * * * /etc/scripts/shoutdown.sh 2>>/tmp/error.log
when it works, look in the file for what the error is
Isn't it easier:
# vi /etc/crontab
0 7 * * * root shutdown -r now
# /etc/init.d/crond restart
and you don't need to create any files with scripts for a simple cron restart)
As Saboteur rightly said - you don't need a script; but in general, the mistake is that you call shoutdown without specifying the full path to it, and the cron does not search for executable files in order to speed up processing (and probably also for security reasons).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question