[HELP] Editing Crontab
-
- Starting out
- Posts: 49
- Joined: Tue Jan 22, 2008 8:56 am
- Location: Australia
[HELP] Editing Crontab
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
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
Last edited by wechap on Fri Jan 25, 2008 2:04 pm, edited 2 times in total.
-
- Starting out
- Posts: 49
- Joined: Tue Jan 22, 2008 8:56 am
- Location: Australia
Re: [HELP] Editing Crontab
Figured it out
-
- Starting out
- Posts: 49
- Joined: Tue Jan 22, 2008 8:56 am
- Location: Australia
Re: [HELP] Editing Crontab
I thought I had figured it out
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?
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?
-
- Starting out
- Posts: 19
- Joined: Thu Dec 13, 2007 9:54 am
- Location: Australia
Re: [HELP] Editing Crontab
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.
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.
-
- Starting out
- Posts: 49
- Joined: Tue Jan 22, 2008 8:56 am
- Location: Australia
Re: [HELP] Editing Crontab
Thanks Stephen, works nicely
- christian
- Moderator
- Posts: 754
- Joined: Tue Sep 04, 2007 5:27 pm
- Location: Germany
- Contact:
Re: [HELP] Editing Crontab
Hello Stephen,Stephen Howard wrote:Add your modifications to autorun.sh and then unmount the partition:
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] #
-
- New here
- Posts: 6
- Joined: Wed Sep 03, 2008 4:34 am
Re: [HELP] Editing Crontab
Hi wechap,
Just one remark upon crontab : if you have already tasks in the crontab, don't forget to save them :
then you can edit and complete crontab.txt.
Anyway, it don't solve the reboot problem.
Lou2step
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
Code: Select all
crontab crontab.txt
Lou2step
Lou2step
TS-109 Pro
TS-109 Pro
-
- Know my way around
- Posts: 107
- Joined: Mon Feb 23, 2009 4:28 pm
Re: [HELP] Editing Crontab
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?
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?
TS-509 Pro
-
- Been there, done that
- Posts: 711
- Joined: Sat Oct 13, 2007 5:26 pm
- Location: Germany
Re: [HELP] Editing Crontab
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.
edit the crontab in /etc/config as before and then run "crontab /etc/config/crontab".
This will configure the crontab with your new entries.
_________________
Windows 7 32/64bit, German
TS-439 , 1x 512GB SSD/1x 512GB Samsung ; SAMBA as NT4 PDC, DHCP/DNS-Server
TS-431+, 1x 1TB WD green, 2x 3TB WD red , 1x 2TB Samsung
TS-220 , 2x 2TB Samsung, for Backup
Windows 7 32/64bit, German
TS-439 , 1x 512GB SSD/1x 512GB Samsung ; SAMBA as NT4 PDC, DHCP/DNS-Server
TS-431+, 1x 1TB WD green, 2x 3TB WD red , 1x 2TB Samsung
TS-220 , 2x 2TB Samsung, for Backup
-
- Know my way around
- Posts: 107
- Joined: Mon Feb 23, 2009 4:28 pm
-
- Know my way around
- Posts: 107
- Joined: Mon Feb 23, 2009 4:28 pm
Re: [HELP] Editing Crontab
Any idea how to get cron to log to a file on the qnap? Or setup cron to send mail?
TS-509 Pro
-
- Starting out
- Posts: 43
- Joined: Thu Jun 18, 2009 1:57 am
Re: [HELP] Editing Crontab
The autorun.sh trick does not appear to work.
-
- Experience counts
- Posts: 1363
- Joined: Sat Feb 06, 2010 2:42 pm
- Location: Taipei, Taiwan
Re: [HELP] Editing Crontab
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'.stoopid wrote:The autorun.sh trick does not appear to work.
/Mike
-
- First post
- Posts: 1
- Joined: Wed May 18, 2011 2:15 pm
Re: [HELP] Editing Crontab
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.
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.
-
- Starting out
- Posts: 43
- Joined: Thu Jun 18, 2009 1:57 am
Re: [HELP] Editing Crontab
Sweet, I'll update the Wiki.micke wrote: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'.stoopid wrote:The autorun.sh trick does not appear to work.
/Mike