unable to edit crontab

Discussion about using NAS on Linux and Unix OS.
Post Reply
mcolvin
New here
Posts: 2
Joined: Mon May 23, 2022 10:31 am

unable to edit crontab

Post by mcolvin »

when I run

Code: Select all

crontab /etc/config/crontab && /etc/init.d/crond.sh restart
I get the following error

Code: Select all

[USER@QNAP-NAS ~]$ sudo crontab /etc/config/crontab && /etc/init.d/crond.sh restart
Stopping periodic command scheduler: sh: /etc/.qsys.log: Permission denied
/etc/init.d/crond.sh: line 57: 31882 Segmentation fault      $DAEMON_MGR crond stop "$CROND"
crond.
Starting periodic command scheduler: sh: /etc/.qsys.log: Permission denied
sh: /etc/.qsys.log: Permission denied
/etc/init.d/crond.sh: line 57: 32026 Segmentation fault      $DAEMON_MGR crond start "$CROND -l 9 -c ${_crontab_path}"
crond.
Any Suggestions how to fix?
User avatar
dolbyman
Guru
Posts: 35015
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: unable to edit crontab

Post by dolbyman »

what user are you using ?

make sure it's admin
mcolvin
New here
Posts: 2
Joined: Mon May 23, 2022 10:31 am

Re: unable to edit crontab

Post by mcolvin »

dolbyman wrote: Mon May 23, 2022 11:13 am what user are you using ?

make sure it's admin
using putty and i'm running as sudo and get the error
User avatar
dolbyman
Guru
Posts: 35015
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: unable to edit crontab

Post by dolbyman »

I am talking about the login user..not what ssh client you are using

use admin
User avatar
OneCD
Guru
Posts: 12037
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: unable to edit crontab

Post by OneCD »

mcolvin wrote: Mon May 23, 2022 10:36 am I get the following error

Code: Select all

[USER@QNAP-NAS ~]$ sudo crontab /etc/config/crontab && /etc/init.d/crond.sh restart
If you SSH into your NAS as any user other than the literal 'admin' user, you'll need to use 'sudo' to reload and restart cron.

You did use 'sudo', but only once. You're getting errors because the cron restart bit isn't being executed as the superuser.

So, you need to use it a second time to restart the cron daemon. Something like:

Code: Select all

sudo crontab /etc/config/crontab && sudo /etc/init.d/crond.sh restart
A bit ugly, but it works.

Or, you could put both commands in a new shell running with superuser privileges:

Code: Select all

sudo sh -c 'crontab /etc/config/crontab && /etc/init.d/crond.sh restart'
mcolvin wrote: Mon May 23, 2022 10:36 am Any Suggestions how to fix?
Follow @dolbyman's advice: SSH in as the literal 'admin' user. Then you won't need to use 'sudo' at-all. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Post Reply

Return to “Linux & Unix (NFS)”