Page 1 of 2

[HELP] Editing Crontab

Posted: Fri Jan 25, 2008 10:40 am
by wechap
Hello All

I'm a complete noob to Unix. I am trying to edit the crontab file, i can edit it by tryping

crontab -e admin

I can then make changes etc, then i try to save it with :wq but it never saves the changes. I'm obviously doing something wrong I just can't figure out what. Using an outdated Linux Handbook doesn't help iether.

Thanks in advance
wechap

Re: [HELP] Editing Crontab

Posted: Fri Jan 25, 2008 1:23 pm
by wechap
Figured it out :wink:

Re: [HELP] Editing Crontab

Posted: Fri Jan 25, 2008 2:10 pm
by wechap
I thought I had figured it out :evil:

I created a txt file called cron.txt with the modified commands and ran crontab cron.txt, I than ran crontab -l to make sure the change had worked and all looked ok, but after rebooting i am back to the default crontab.

I am trying to change the imr_all command so that it only runs on the folder that contains the pictures instead of all the folders in my Qmultimedia share, otherwise it runs for hours before it completes.

Anyone know why the crontab would reset to the default?

Re: [HELP] Editing Crontab

Posted: Fri Jan 25, 2008 2:48 pm
by Stephen Howard
Hi. Changes to /etc don't survive a reboot. However, QNAP have provided a method to automatically recreate customisations after every reboot:

The way to do it is to put your customisations in autorun.sh, a script that qnap runs immediately after a reboot. autorun.sh is hidden away on a partition that is normally unmounted, but it can be accessed as follows (for my dual disk 209 anyway):

# mount /dev/mtdblock5 /tmp/config
# cd /tmp/config

Add your modifications to autorun.sh and then unmount the partition:

# cd /
# umount /tmp/config

From now on your customisations will be automatically recreated on every reboot.

Re: [HELP] Editing Crontab

Posted: Fri Jan 25, 2008 3:59 pm
by wechap
Thanks Stephen, works nicely

Re: [HELP] Editing Crontab

Posted: Sun May 11, 2008 6:00 am
by christian
Stephen Howard wrote:Add your modifications to autorun.sh and then unmount the partition:
Hello Stephen,

please can you explain to me what excactly is to change or to add when i have changed the crontab ?

Code: Select all

[~] # mount /dev/mtdblock5 /tmp/config
[~] # cd /tmp/config
[/tmp/config] # cat autorun.sh
#!/bin/sh


# added by SSODS (ssods-ts $Revision: 1.3 $) on Sun Apr 20 00:08:15 CEST 2008
ln -sf /share/HDA_DATA /volume1 # SSODS (keep the tag!)
/volume1/SSODS/etc/init.d/rc.ssods start # SSODS (keep the tag!)
[/tmp/config] #
regards Christian

Re: [HELP] Editing Crontab

Posted: Sun Aug 09, 2009 3:22 pm
by lou2step
Hi wechap,
Just one remark upon crontab : if you have already tasks in the crontab, don't forget to save them :

Code: Select all

crontab -e >crontab.txt
then you can edit and complete crontab.txt.

Code: Select all

crontab crontab.txt
Anyway, it don't solve the reboot problem.
Lou2step

Re: [HELP] Editing Crontab

Posted: Mon Oct 26, 2009 3:35 am
by v2k
I run crontab -e; make some changes, save them.

Then I run crontab -l or crontab -e and the changes are gone.

I also tried stopping crond, editing /etc/config/crobtab and restarting crond; again my changes are gone.

Anyone had this problem?

Re: [HELP] Editing Crontab

Posted: Mon Oct 26, 2009 5:15 am
by Eraser-EMC2-
Hi,

edit the crontab in /etc/config as before and then run "crontab /etc/config/crontab".
This will configure the crontab with your new entries.

Re: [HELP] Editing Crontab

Posted: Mon Oct 26, 2009 5:37 am
by v2k
Perfect, thank you!

Re: [HELP] Editing Crontab

Posted: Tue Oct 27, 2009 1:36 pm
by v2k
Any idea how to get cron to log to a file on the qnap? Or setup cron to send mail?

Re: [HELP] Editing Crontab

Posted: Sun Apr 03, 2011 6:25 am
by stoopid
The autorun.sh trick does not appear to work.

Re: [HELP] Editing Crontab

Posted: Sun Apr 03, 2011 1:54 pm
by micke
stoopid wrote:The autorun.sh trick does not appear to work.
Different mount points for ARM and Intel systems, but you don't need it to edit the crontab. Make your changes to /etc/config/crontab and run 'crontab /etc/config/crontab'.

/Mike

Re: [HELP] Editing Crontab

Posted: Wed May 18, 2011 2:22 pm
by nicholjohns
Editing crontabs follow thats tips first crontab restruction,then you give command,open the file syntex,disable the mail account then generate log file for crontab activity.use this contrab command
export EDITOR=vi ;to specify a editor to open crontab file.
crontab -e Edit your crontab file, or create one if it doesn’t already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file.

Re: [HELP] Editing Crontab

Posted: Wed Jun 08, 2011 1:35 am
by stoopid
micke wrote:
stoopid wrote:The autorun.sh trick does not appear to work.
Different mount points for ARM and Intel systems, but you don't need it to edit the crontab. Make your changes to /etc/config/crontab and run 'crontab /etc/config/crontab'.

/Mike
Sweet, I'll update the Wiki.