0

From the log it seems like it tries to run at scheduled time

Apr 29 10:00:01 momspi CRON[13324]: pam_unix(cron:session): session opened for user admin(uid=1000) by (uid=0)
Apr 29 10:00:01 momspi CRON[13325]: (admin) CMD (./media/backup.sh)
Apr 29 10:00:01 momspi CRON[13324]: pam_unix(cron:session): session closed for user admin
Apr 29 10:00:01 momspi postfix/pickup[13242]: B432C89D70: uid=1000 from=<admin>
Apr 29 10:00:01 momspi postfix/cleanup[13329]: B432C89D70: message-id=<[email protected]>
Apr 29 10:00:01 momspi postfix/qmgr[13126]: B432C89D70: from=<[email protected]>, size=661, nrcpt=1 (queue active)
Apr 29 10:00:04 momspi postfix/smtp[13331]: B432C89D70: to=<[email protected]>, relay=hotmail-com.olc.protection.outlook.com[52.101.194.18]:25, delay=2.3, d>
Apr 29 10:00:04 momspi postfix/cleanup[13329]: 049AF89D72: message-id=<[email protected]>
Apr 29 10:00:04 momspi postfix/qmgr[13126]: 049AF89D72: from=<>, size=3588, nrcpt=1 (queue active)
Apr 29 10:00:04 momspi postfix/bounce[13333]: B432C89D70: sender non-delivery notification: 049AF89D72
Apr 29 10:00:04 momspi postfix/qmgr[13126]: B432C89D70: removed
Apr 29 10:00:04 momspi postfix/local[13334]: 049AF89D72: to=<[email protected]>, relay=local, delay=0.04, delays=0.01/0.02/0/0.01, dsn=2.0.0, status>
Apr 29 10:00:04 momspi postfix/qmgr[13126]: 049AF89D72: removed
Apr 29 10:01:02 momspi crontab[13319]: (admin) END EDIT (admin)

but my log file is NOT updated and new files that should sync are NOT present

my cron job is setup as such (once a day at 10am)

[email protected]  
0 10 * * * ./media/backup.sh

and the script is fairly basic as well

#!/bin/bash
now=$(date)
LOG_FILE="/media/backuplog.txt"
{
echo "backing up $now"
rsync --exclude-from='/media/backupexclude.txt' -avhzz --delete /mount/skittlesshare/ /media/usb1/sharedmedia/
}> ${LOG_FILE}

we can see too that its using the admin user. Which is what i would expect and when manually running it (as admin), there are no issues.

any ideas why its not working as expected?

also email doesnt work/send

1 Answer 1

1

You are using ./media when I suspect you meant to use /media. If you use ./ that means you are giving a path relative to your current directory. So, for example, if you are in /some/dir/, then ./media would mean /some/dir/media.

So give the full path to the script, presumably /media/backup.sh, instead and it should work.

2
  • any idea about why email doesnt work?
    – owen gerig
    Commented Apr 29 at 19:03
  • 1
    @owengerig that's a separate issue. Please ask a new question and make sure to explain what "doesn't work" means (any errors? Wrong email sent? No email sent?), and whether your system has been set up to send emails. Can you send emails outside cron? And, if it has been set up, mention the mailserver you are using and how you set it up.
    – terdon
    Commented Apr 29 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .