-1

This question already has an answer here:

I have to command in my cronjob list. I for mysql backup, one for directory cp command.

When I run commands, They work. But When I run command the below, I get error:

run-parts /etc/cron.daily

ERROR:

cp: cannot create regular file 'dpkg.status': Permission denied
touch: cannot touch 'dpkg.status': Permission denied
savelog: could not touch dpkg.status
cp: cannot create regular file 'dpkg.diversions': Permission denied
touch: cannot touch 'dpkg.diversions': Permission denied
savelog: could not touch dpkg.diversions
cp: cannot create regular file 'dpkg.statoverride': Permission denied
touch: cannot touch 'dpkg.statoverride': Permission denied
savelog: could not touch dpkg.statoverride
/etc/cron.daily/logrotate: 6: /etc/cron.daily/logrotate: cannot create status.clean: Permission denied
/etc/cron.daily/logrotate: 7: /etc/cron.daily/logrotate: cannot create status.clean: Permission denied
mv: cannot stat 'status.clean': No such file or directory
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error switching euid to 0 and egid to 108: Operation not permitted
error: error creating output file /var/lib/logrotate/status.tmp: Permission denied
run-parts: /etc/cron.daily/logrotate exited with return code 1
start-stop-daemon: unable to set gid to 12 (Operation not permitted)
run-parts: /etc/cron.daily/man-db exited with return code 2
flock: cannot open lock file /run/mlocate.daily.lock: Permission denied
run-parts: /etc/cron.daily/mlocate exited with return code 66
cp: cannot create regular file 'passwd.bak': Permission denied
cp: cannot create regular file 'group.bak': Permission denied
cp: cannot open '/etc/shadow' for reading: Permission denied
cp: cannot open '/etc/gshadow' for reading: Permission denied
run-parts: /etc/cron.daily/passwd exited with return code 1

MY CRONS:

0 6 * * * zip -rj /home/dan/Dropbox/$(date '+%Y%m%d%H%M%S')_bk.zip /home/dan/dan_portfolio/src/
0 6 * * * mysqldump -u 'danport' -p'I_CHANGE_THIS' danport_db > /home/dan/Dropbox/$(date '+%Y%m%d%H%M%S')_db.sql

marked as duplicate by Jeff Schaller, G-Man, Archemar, elbarna, Kiwy Mar 19 '18 at 8:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Your user's crontab and the jobs in /etc/cron.daily are different things - it looks like you are simply trying to run the cron.daily jobs as an unprivileged user – steeldriver Mar 17 '18 at 19:48
  • How can I test my user's cronjobs? – Gep Gecici Mar 17 '18 at 20:12
  • 1
    I'm not aware of a way to make cron run on demand - you can however edit them to run sooner or more frequently for the purpose of testing. FWIW as written they will almost certainly fail due to unescaped per-cent characters - see for example How can I execute date inside of a cron tab job? – steeldriver Mar 17 '18 at 20:22
-1

Escaping the date solve my problem.

\%Y\%m\%d\%H\%M\%S

Not the answer you're looking for? Browse other questions tagged or ask your own question.