Shell script and cron entry disappeared!?

Questions about SNMP, Power, System, Logs, disk, & RAID.

Re: Shell script and cron entry disappeared!?

Postby smguenther » Tue Jul 24, 2012 2:01 pm

Hi,

I have remove the space between "#!" and "/bin/sh" but still the script isn't executed by cron.

And I have changed the script so that the logfile would be created in /share/MD0_DATA/admin

Stefan
smguenther
New here
 
Posts: 9
Joined: Sat Mar 31, 2012 9:50 pm
NAS Model: TS-439 Pro II

Re: Shell script and cron entry disappeared!?

Postby pwilson » Tue Jul 24, 2012 2:57 pm

smguenther wrote:I have remove the space between "#!" and "/bin/sh" but still the script isn't executed by cron.
And I have changed the script so that the logfile would be created in /share/MD0_DATA/admin



Sorry Stefan, but that's all I got. Will the script run "without logging" from cron?


Patrick.

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-419P+ w/ 4 * Seagate Barracuda 2TB 5900rpm (RAID5) - FW: 3.8.1 Build 20121205
Forums: View My Profile - Search My Posts - Send Private Message - View My Photo - Top Community Forum Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs - HowTos - QNAP Video Library
User avatar
pwilson
Moderator
 
Posts: 3794
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada
NAS Model: TS-419P+

Re: Shell script and cron entry disappeared!?

Postby smguenther » Tue Jul 24, 2012 3:55 pm

Hi,

is there maybe a way to log, whether cron even tries to execute the script and whether it recognizes the entry in the crontab file?
Maybe this could give me an idea what the problem could be.

Stefan
smguenther
New here
 
Posts: 9
Joined: Sat Mar 31, 2012 9:50 pm
NAS Model: TS-439 Pro II

Re: Shell script and cron entry disappeared!?

Postby michaeldaly600 » Wed Aug 08, 2012 8:06 pm

whilst troubleshooting using the above guidelines I found that cron would not run an updated crontab file (ie updated via Method 1 bis). I eventually found there were two instances of crond running eg
Code: Select all
11155 admin       668 S   /usr/sbin/crond -l 9 -c /tmp/cron/crontabs
19980 admin      4432 S   /usr/local/apache/bin/apache -k start
29493 admin       628 S   /usr/sbin/crond -l 9 -c /tmp/cron/crontabs

Running the stop script twice, then starting, seemed to solve the problem ie:
Code: Select all
 /etc/init.d/crond.sh stop (twice)
 /etc/init.d/crond.sh start

HTH
'600
michaeldaly600
Starting out
 
Posts: 14
Joined: Fri Sep 30, 2011 5:23 am
NAS Model: SS-439 Pro

Re: Shell script and cron entry disappeared!?

Postby Briain » Wed Aug 08, 2012 8:54 pm

Hi

All this additional complexity puzzles me as I've always done it the easy way (and it works on both my TS-219P+ and TS-659 Pro):

First, I copy the existing crontab to a share

cp /etc/config/crontab /share/Public

I then edit it using Notepad++

I then do the below (still being at /etc/config) to remove the one in /etc/config, then replace it with my modified one, then restart the crond.sh:

rm crontab
cp /share/Public/crontab .
/etc/init.d/crond.sh restart

The only thing that would be re-written (if you changed it) is the /etc/init.d/backup_conf.sh line - if you change that one, it changes it back again - but the rest of them seem to persist.

# m h dom m dow cmd
3 3 * * * /sbin/vs_refresh
3 3 * * * /sbin/clean_reset_pwd
2 3 * * * /sbin/hwclock -s
3 3 * * * /etc/init.d/idmap.sh dump
# 0-59/15 * * * * /etc/init.d/nss2_dusg.sh
4 3 * * 3 /etc/init.d/backup_conf.sh

Out of curiosity, a new entry has appeared since I updated to 3.7.3 (nss2_dusg.sh); does anyone know what it does? [Edit: Just found out that it's surveillance station, which I don't use, so I've #'d it out; if you just delete it, it pops back after a reboot, but using # in front of it - as shown above - survives a reboot].

Bri
Last edited by Briain on Sun Aug 12, 2012 5:34 pm, edited 2 times in total.
User avatar
Briain
Been there, done that
 
Posts: 762
Joined: Tue Apr 20, 2010 11:56 pm
Location: Edinburgh (Scotland)
NAS Model: TS-459 Pro

Previous

Return to System & Disk Volume Management

Who is online

Users browsing this forum: No registered users and 9 guests