why does crontab - returns 0481-071 error on aix

Viewed 34

On Linux I use

cat filename | ssh dradmqa1@10.196.33.12 "crontab -" ..

to replace a remote crontab. If I execute this on AIX I get : crontab: 0481-071 Cannot access the file I can execute

ssh dradmqa1@10.196.33.12 "crontab -l"

and receive correct output, but replacing the crontab is not working. Is there a special option/setting to be done for AIX?

1 Answers

AIX crontab haven't got such option, also your method would overwrite crontab without creating a backup. Try something like this:

cat newcrontabfile | ssh aixuser@aixhost '
 umask 077;
 Now=$(date +%Y%m%d.%H%M%S);
 crontab -l >crontab.before.$Now;
 cat >crontab.after.$Now;
 crontab crontab.after.$Now'

Edit: added umask 077 -- you might not want others to see your crontab files

Related