E
E
elisey4742016-04-12 16:07:49
linux
elisey474, 2016-04-12 16:07:49

Why is crontab not executing the script?

In crontab for root added entry
00 4 * * * /home/user/reboot.sh
@reboot /home/user/startup.sh
reboot.sh:
#!/bin/bash
umount -l /mnt
umount -l /mnt2
e2fsck -fy /dev/sda2
e2fsck -fy /dev/sdb1
reboot
startup.sh
#!/bin/bash
mount /dev/sda2 /mnt
mount /dev/sdb1 /mnt2 Script permissions
:
-rwxrwxrwx 1 user 92 Apr 12 15: 49 reboot.sh
-rwxrwxrwx 1 user 55 Apr 12 15:50 startup.sh
In the morning I discovered that two disks were simply unmounted and the system did NOT reboot.
The question is why?
P. s. I tried to rearrange the time and track it, but the script starts up in general and looks at the output of ps axu in the console. But the script doesn't even seem to run. Why?
Distributor ID:Linaro
Description:Linaro 14.04
Release:14.04
Codename:trusty

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2016-04-12
@elisey474

Specify full links to files
, etc.

V
viiy, 2016-04-12
@viiy

What is it?
Everything should work if:
- reboot.sh is executable, check "ls -l reboot.sh", there should be "x" in properties
- syntax is correct, use "crontab -e" instead of manually editing cron files
- all command paths in script is in the PATH variable at the time of execution (comment from Vladimir)
Instead of ps, look better at the logs in /var/log/syslog with the CRON prefix

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question