Hi, I am posting this in the Command Line forum, if this is incorrect, mods please move as required.
Also, I am a complete newbie so please be gentle and help me. I have no where else to turn.
I am trying to set up a cron job to run scheduled backups to a QNAP box. When I run the executable manually, it works perfect.
I have an Expect file (pmsbackup.exp) for the purpose of authentication (I have to do this because I need to shut down the app before backup so I need to enter a password automatically). This file spawns the actual script that does the backup (pmsbackup-external2.sh) and when I run the Expect file manually, the backup script works perfectly.
But not when I try and schedule it as a cron job.
I created a file jobinfo which has:
5 0 * * 3 /home/leif/pmsbackup.exp >/home/leif/mycron.log
By my calculations, the job should run 5 minutes after midnight on Wednesdays.
I then enter it by crontab jobinfo.
I can see it scheduled:
leif@HP-ProLiant-MicroServer:~$crontab -l
05 0 * * 3 /home/leif/pmsbackup.exp >/home/leif/mycron.log
But the job never runs. If I go grep CRON /var/log/syslog, I see:
Jun 8 00:05:01 HP-ProLiant-MicroServer CRON[109200]: (leif) CMD (/home/leif/pmsbackup.exp)
Plus:
sudo systemctl status cron
Jun 08 00:05:01 HP-ProLiant-MicroServer CRON[127581]: pam_unix(cron:session): session opened for user leif>
Jun 08 00:05:01 HP-ProLiant-MicroServer CRON[127581]: (CRON) info (No MTA installed, discarding output)
Jun 08 00:05:01 HP-ProLiant-MicroServer CRON[127581]: pam_unix(cron:session): session closed for user leif
So it looks like the cron job is scheduled to run.
This is in the file I have to see the results:
leif@HP-ProLiant-MicroServer:~$ catmycron.log
spawn pmsbackup-external2.sh
Please help.
Also, I am a complete newbie so please be gentle and help me. I have no where else to turn.
I am trying to set up a cron job to run scheduled backups to a QNAP box. When I run the executable manually, it works perfect.
I have an Expect file (pmsbackup.exp) for the purpose of authentication (I have to do this because I need to shut down the app before backup so I need to enter a password automatically). This file spawns the actual script that does the backup (pmsbackup-external2.sh) and when I run the Expect file manually, the backup script works perfectly.
But not when I try and schedule it as a cron job.
I created a file jobinfo which has:
5 0 * * 3 /home/leif/pmsbackup.exp >/home/leif/mycron.log
By my calculations, the job should run 5 minutes after midnight on Wednesdays.
I then enter it by crontab jobinfo.
I can see it scheduled:
leif@HP-ProLiant-MicroServer:~$crontab -l
05 0 * * 3 /home/leif/pmsbackup.exp >/home/leif/mycron.log
But the job never runs. If I go grep CRON /var/log/syslog, I see:
Jun 8 00:05:01 HP-ProLiant-MicroServer CRON[109200]: (leif) CMD (/home/leif/pmsbackup.exp)
Plus:
sudo systemctl status cron
Jun 08 00:05:01 HP-ProLiant-MicroServer CRON[127581]: pam_unix(cron:session): session opened for user leif>
Jun 08 00:05:01 HP-ProLiant-MicroServer CRON[127581]: (CRON) info (No MTA installed, discarding output)
Jun 08 00:05:01 HP-ProLiant-MicroServer CRON[127581]: pam_unix(cron:session): session closed for user leif
So it looks like the cron job is scheduled to run.
This is in the file I have to see the results:
leif@HP-ProLiant-MicroServer:~$ catmycron.log
spawn pmsbackup-external2.sh
Please help.
Last edited: