cancel
Showing results for 
Search instead for 
Did you mean: 

Startup script not work

 
aamir4u
Regular Advisor

Startup script not work

hi,

This is my script

cat .syslog1.sh

 

cp /var/adm/syslog/syslog.log /c02/oldsyslog/syslog2.`date +%F--%T`

 

This is link file:--

ln -s /sbin/init.d/.syslog1.sh /sbin/rc2.d/K008.syslog1.sh

ln -s /sbin/init.d/.syslog1.sh /sbin/rc3.d/S992.syslog1.sh

 

but its not work on server startup.

Additional i am also make configuration file on under /etc/rc.config.d  .syslog1.shconf

cat .syslog1.shconf

#!/sbin/sh
# @(#)B.11.31_LR
# syslog configuration.  See syslog(1m)
#
# .syslog1.sh:  Set to 1 to start .sylog1.sh daemon
#
.syslog1.sh=1

 

 

How can its works on server startup time.

 

Thanks

 

 

 

Thanks
aamir uddin
5 REPLIES

Re: Startup script not work

>cp /var/adm/syslog/syslog.log /c02/oldsyslog/syslog2.`date +%F--%T`

 

Where is your: #!/sbin/sh line?

You should model it off of /sbin/init.d/template.  See rc(1m).

Also, you shouldn't really name your script with a leading "." since there is no need to "hide" it.

 

>ln -s /sbin/init.d/.syslog1.sh /sbin/rc2.d/K008.syslog1.sh

 

You want to do this on shutdown too?

 

>.syslog1.sh=1

 

This is not valid.  Shell variables can't have ".".  Also, it doesn't appear you even use this variable in your .syslog1.sh script.

 >How can it work on server startup time?

 

If you follow the rules in rc(1m), that should work.

aamir4u
Regular Advisor

Re: Startup script not work

Dear Dennis Thanks 

 

You want to do this on shutdown too?

 

How can do on shutdown?

 

Thanks

 

Thanks
aamir uddin

Re: Startup script not work

>How can do on shutdown?

 

By having this /sbin/rc2.d/K008.syslog1.sh symlink it will be done.  But does it make sense?

aamir4u
Regular Advisor

Re: Startup script not work

Hi,

 

I have been done all process,but whenever server boots its not copy syslog.log file on /c02/oldsyslog folder.

and i have changed .syslog1.sh file to syslog1.sh

Please look it.


uatdata2#
uatdata2#
uatdata2#cd /sbin/init.d
uatdata2#ll syslog1.sh
-rwxrwxrwt   1 root       sys             99 Feb  7 17:58 syslog1.sh
uatdata2#
uatdata2#cd /sbin/rc3.d
uatdata2#ll
total 0
lrwxr-xr-x   1 root       root            23 Dec 15  2010 S100nfs.server -> /sbin/init.d/nfs.server
lrwxrwxrwx   1 bin        bin             22 Dec 31  2010 S800cmcluster -> /sbin/init.d/cmcluster
lr--r--r--   1 bin        bin             24 Dec 15  2010 S823hpws_apache -> /sbin/init.d/hpws_apach                                                         e
lr--r--r--   1 bin        bin             24 Dec 15  2010 S823hpws_tomcat -> /sbin/init.d/hpws_tomca                                                         t
lr--r--r--   1 bin        bin             24 Dec 15  2010 S823hpws_webmin -> /sbin/init.d/hpws_webmi                                                         n
lr--r--r--   1 bin        bin             26 Dec 15  2010 S823hpws_webproxy -> /sbin/init.d/hpws_web                                                         proxy
lr--r--r--   1 bin        bin             26 Dec 15  2010 S823hpws_xmltools -> /sbin/init.d/hpws_xml                                                         tools
lrwxr-xr-x   1 bin        bin             18 Dec 27  2010 S828kwdbd -> /sbin/init.d/kwdbd
lr-xr-xr-x   1 bin        bin             25 Dec 15  2010 S829hpvmguestlib -> /sbin/init.d/hpvmguest                                                         lib
lrwxrwxrwx   1 root       sys             21 Jan  5  2011 S960init.crs -> /sbin/init.d/init.crs
lr-xr--r--   1 bin        bin             23 Dec 23  2010 S990dtlogin.rc -> /sbin/init.d/dtlogin.rc
lrwxrwxrwx   1 root       sys             23 Feb  7 18:07 S992syslog1.sh -> /sbin/init.d/syslog1.sh
lrwxr-xr-x   1 root       sys             18 Dec 15  2010 S998amgrd -> /sbin/init.d/amgrd
lrwxr-xr-x   1 root       sys             21 Dec 31  2010 S99prngd.rc -> /sbin/init.d/prngd.rc
uatdata2#cat /sbin/init.d/syslog1.sh
#!/sbin/sh
# @(#)B.11.31_LR

cp /var/adm/syslog/syslog.log /c02/oldsyslog/syslog2.`date +%F--%T`
uatdata2#

 

 

 

As we know hpux will move syslog.log to OLDsyslog.log after a reboot ..so we have only OLDsyslog.log and syslog.log after reboot.How to make a custom startup script that will move the syslog.log file away to a safe location each time the system reboots.

 

Please tell how can do that

 

Thanks

 

Thanks
aamir uddin

Re: Startup script not work

>but whenever server boots it's not copy syslog.log file on /c02/oldsyslog folder.

 

Have you looked at /etc/rc.log to see if it was executed?

 

>HP-UX will move syslog.log to OLDsyslog.log after a reboot .. so we have only OLDsyslog.log and syslog.log after reboot.

 

I assume from rc.log, this is done with /sbin/rc2.d/S220syslogd and by the time your script is invoked, the file is already OLDsyslog.log.

 

>How to make a custom startup script that will move the syslog.log file away to a safe location each time the system reboots.

 

As I mentioned above, you need to copy /sbin/init.d/template and put your changes in it.

As it is, it will invoke your script for start and start_msg unless you use the template.