[Solved] Some entries in crontab do not persist after reboot

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
Post Reply
urukhai
Starting out
Posts: 32
Joined: Tue Oct 17, 2017 10:17 pm

[Solved] Some entries in crontab do not persist after reboot

Post by urukhai »

I am running FW 5.0.0.1986.
I have put a few bash scripts in crontab by manually

Code: Select all

nano /etc/config/crontab
. One of them is to rsync data between 2 QNAP. The script runs perfectly well at every scheduled time.
For some reasons only this particular entry was removed every time after reboot. The entry looks like this

Code: Select all

30 12 * * 1-5 /bin/sh /share/localscript/intraRsync.sh
I have only Malware Remover installed but not the Security Counselor. I checked every log but could not find any trace why this entry was removed.

My questions are:
1) Is nano /etc/config/crontab a valid way to edit crontab after QTS 5?
2) Are there any keywords in script name or command that QTS does not like and remove after reboot?
3) Any specific location in crontab for local scheduled tasks?

Any input are welcomed.
Last edited by urukhai on Thu May 05, 2022 5:35 pm, edited 1 time in total.
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: Some entries in crontab do not persist after reboot

Post by FSC830 »

Hi,
afaik not. Me too running a manual edited crontab at several QTS versions and up to now never a line disappeared!?
I am always using

Code: Select all

crontab -e
and

Code: Select all

vi /etc/config/crontab
to edit the crontab file.
At all of my NAS MR is running daily and currently no crontab entry is deleted.

Very strange..
Only difference I can see: I did never put a /bin/sh command in front of the script call.

Regards
urukhai
Starting out
Posts: 32
Joined: Tue Oct 17, 2017 10:17 pm

Re: Some entries in crontab do not persist after reboot

Post by urukhai »

The following should be the culprit:

Code: Select all

./init.d/nc.sh:sed -r "/nc\./d" "${CRONTAB_CONF}" > /tmp/nc.crontab
Any crontab entries containing "nc." will be removed. No wonder my intraRsync.sh got removed after reboot :lol: :lol:
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: Some entries in crontab do not persist after reboot

Post by FSC830 »

Nice to know... :mrgreen:

Regards
blackdog
Starting out
Posts: 31
Joined: Sat Aug 13, 2011 9:41 pm

Re: [Solved] Some entries in crontab do not persist after reboot

Post by blackdog »

similar problem. My entry

Code: Select all

35 15 * * * /share/backup/rclone/run_sync.sh >/dev/null 2>&1 
get removed at each reboot.
Why ? and how can I make it permanent ?
Thanks
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: [Solved] Some entries in crontab do not persist after reboot

Post by FSC830 »

If its the same problem as @urukhai posted at May 05, just rename the script in that way, that name contains no "nc", i.e. run_copy.sh .

Regards
blackdog
Starting out
Posts: 31
Joined: Sat Aug 13, 2011 9:41 pm

Re: [Solved] Some entries in crontab do not persist after reboot

Post by blackdog »

thanks, I didn't noticed that I have an "nc" in the line.
Post Reply

Return to “Users' Corner”