I'm baffled as to why this isn't working.
I've tried redirecting STDOUT and STDERR using "&>" and also "2>&1" and neither seems to work. I still get e-mailed by this cron job (every minute!) with smbclient complaining that there are no files in the share.
* * * * * smbclient //scanner/scan-import secretpass -U administrator -c "prompt; mget *; del *" &> /dev/null
For the curious: A client has an old and expensive scanner that scans multiple documents at high speed--but the software has no way to configure the save location. They don't want the documents saved directly on the old XP workstation, so I've shared out the save location and use this cron job to automatically pull the documents over to their linux server.
Bash supports redirecting stdout and stdin together using
&>
, butsh
does not. Cron used the Bourne shell (sh
) rather than Bash. Use>/dev/null 2>&1
instead.I don't think you need the first "&" do you? Just "> /dev/null 2>&1";
Try wrapping all this in a separate shell script:
and edit the cron line to