[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Linux startup, Wheezy -- a required script won't run on startup, but can run manually without any trouble




On 10/06/2016 6:17 AM, Dan Purgert wrote:
>> Perhaps, but why?  I'm not asking it to log anything to syslog; just to
>> create it's own log file in the /var/log directory.
> 
> Just going off the comments at the top -- states "required-start:
> $syslog".  Although, I suppose that you could've just forgotten to
> remove that bit.

I'm sure it can be removed, I started off with the /etc/init.d/skeleton
and tried to work from there when the script didn't run at startup
without the extras at the top.

>> [snip]
>> Weird artifcat of something (perhaps GPG due to signing?), my copy as
>> sent to the list is clean.  The script works perfectly if ran with an
>> interactive shell; right now the script isn't destructive, so I can run
>> it as many times as I like and it works fine.  The plan is to adjust the
>> script, I think you can see how, but not until it works as expected.
> 
> How are you calling it while logged in?  I'm starting to wonder if it's
> a difference between [da]sh and bash (or whatever your standard login
> shell is).  

# echo $SHELL
/bin/bash

# /etc/init.d/archive-system-mail start
+ NAME=archive-system-mail
+ SCRIPTNAME=/etc/init.d/archive-system-mail
+ trap do_cleanup 99 HUP INT TERM
+ ARCHIVE_DIR=
+ /bin/date +%Y%m%d
+ DATEX=20160610
+ /usr/bin/basename /etc/init.d/archive-system-mail
+ PROGNAME=archive-system-mail
+ do_main
+ date +%Y%m%d%H%M%S
+ /usr/bin/tee /var/log/archive-system-mail--20160610062530.log
+ get_archivedir
+ ARCHIVE_DIR=/backup/mail/system_filter_all_mail/archive/20160610a
+ [ ! -d /backup/mail/system_filter_all_mail/archive/20160610a ]
+ VER=a
+ return 0
+ [ ! -d /backup/mail/system_filter_all_mail/archive/20160610a ]
+ /bin/mkdir /backup/mail/system_filter_all_mail/archive/20160610a
+ /usr/bin/touch
/backup/mail/system_filter_all_mail/archive/20160610a/log--lots.23380
+ /bin/mkdir
/backup/mail/system_filter_all_mail/archive/20160610a/Maildir.23380
+ :


> Also, not entirely sure what the 'VER=$x" assignment is doing, as you
> don't seem to read $VER anywhere else.

Yes, it is useless there; copy and pasted the version part from another
script.  I noticed that when I read over my message to the list, but
whilst that is true, it shouldn't make any difference to the script
being able to run or not at start up.

The script does have #! /bin/sh at the top and /bin/sh does point to
/bin/dash as follows:

# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Feb 21 17:40 /bin/sh -> dash



Thanks
AndrewM

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: