I have a cronjob in my crontab.
When I specify the job to be executed in 2minutes, I wait, and then I can see files created by the job, I can see the process with ps. The job takes at least 10minutes to complete.
But, if I specify the job to be executed in 2minutes, and then I log out, I come back a few minutes thereafter, and it seems that the job has not been executed (no files created, and process not in ps).
When I look to the /var/log/syslog I can see that the job 'started', but immediately (at the same second) cron tries to send a mail. Probably the mail with the result. (well, sendmail is not correctly configured but this should not be the root cause).
Do you have any idea ?
Here are some concrete example : (python is the name of my machine)
I edit the crontab using crontab -e.
Here is the crontab :
user@python:~$ crontab -l
[...]
# m h dom mon dow command
50 9 * * * /home/user/scripts_automated/crontab1.sh
It should run at 9:50
Here is the content of the /var/log/syslog :
[...]
Nov 6 09:48:02 python crontab[30913]: (user) BEGIN EDIT (user)
Nov 6 09:48:18 python crontab[30913]: (user) REPLACE (user)
Nov 6 09:48:18 python crontab[30913]: (user) END EDIT (user)
Nov 6 09:50:01 python CRON[30936]: (user) CMD (/home/user/scripts_automated/crontab1.sh)
Nov 6 09:50:01 python sendmail[30938]: sA68o1a4030938: from=user, size=347, class=0, nrcpts=1, msgid=<201411060850.sA68o1a4030938@python>, relay=user@localhost
[...]
As you can see in the log, I edited the crontab
at 09:48:02, then I logged out. I come back on the machine (with ssh
), and the job did not produce any files it should have produced.
Here is the content of the script :
user@python:~$ cat scripts_automated/crontab1.sh
# 0 ------------------------------------------------------
datenow=`date +%F_%H-%M-%S`
/home/user/scripts_automated/script_1_cisco_grab.sh > /home/user/scripts_automated/crontab/run_${datenow}_.txt 2>&1 &
echo $! > /home/user/scripts_automated/crontab/pid_${datenow}.txt
ln -s /home/user/scripts_automated/crontab/pid_${datenow}.txt /home/user/scripts_automated/crontab/pid_last_run.txt
and no file is produced. I would at least expect the file pid_${datenow}.txt
to exist with the pid of the background command. But nothing.
If I don't log out, then scripts executes, produces output files, pid_${datenow}
file, and so on ...
mount
to see what is mounted/home/stef
(e.g.) or/home
. You don't need to decrypt your home directory, just copy the executable file somewhere that is not encrypted, as I indicated in my answer. Decrypting a home dir is possible, but you should make a new question for that, with details about your system (what Linux version, what encryption etc).