Score:0

Crontab backup script not working properly

mz flag

i have a crontab job as root user, which backups some files from smb share. It's triggered as it should at 23:59 everyday, but it doesn't do it's thing. No files are being uploaded to backup storage. Strange thing because when i run the script manually it works perfectly fine...

Crontab entry looks like this:

59 23 * * * /mnt/backup/directory/smb_backup/smb.sh > /tmp/smb_backup 2>/tmp/smb_backup_error

Script smb.sh:

#!/bin/sh
smbget -R -au smb://ip_address/sdb1/Dir/backup

Output from /tmp/smb_backup is empty...

/tmp/smb_backup shows

Downloaded 0b in 18 seconds

Logs are showing that cronjob is triggered with no issue

Anyone willing to help with solving the mystery? :)

hr flag
iirc `smbget` has both a `-v` (verbose) and a `-d` (debug) option so you might be able to get some more diagnostic information that way. The latter takes a numeric level I think ex. `-d 3`
waltinator avatar
it flag
See https://unix.stackexchange.com/questions/673908/why-crontab-doesnt-execute-a-scheduled-bash-script/673918#673918
Klimpason avatar
mz flag
Mystery solved, in the script i had to specify a location of a backup folder. `#!/bin/sh cd /tmp/backup smbget -R -au smb://ip_address/sdb1/Dir/backup` Thanks :)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.