Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
Showing results for 
Search instead for 
Did you mean: 

HPUX syslog 11.23

Super Advisor

HPUX syslog 11.23

Hi All,

As we know hpux will move syslog.log to OLDsyslog.log after a reboot we have only OLDsyslog.log and syslog.log after reboot.How to make a custom startup script that will move the OLDsyslog.log file away to a safe location each time the system boots, so that there will be no need to overwrite OLDsyslog.log when the system boots next time?..

what entries to be made in starup scripts and where is the syslog scripts resides ?


Mel Burslan
Honored Contributor

Re: HPUX syslog 11.23

The script in charge of copying syslog.log to OLDsyslog.log is the syslogd startup script /sbin/init.d/syslogd

My suggestion is not to mess with this script at all, but write a site-specific script, assign it proper S### and K### symbolic links to it in /etc/rc.#.d directory and run this script as the last step of your rc scripts during reboot. In that script you can do whatever housekeeping that your heart desires without impacting the boot of the system.

Consider something going wrong while your are saving your OLD Syslog to some other location. You may end up running a system without a syslog and don;t notice it until it is too late. Avoid it like a plague.
UNIX because I majored in cryptology...
Frequent Advisor

Re: HPUX syslog 11.23

You can use the following script to retain your 4 copies of syslogs by scheduling this in cron at your convenient.

if [[ -a /home/dir/syslog.4.Z ]]; then
rm /home/dir/syslog.4.Z

cd /var/adm/syslog
for i in 3 2 1
let j=$i+1
if [[ -a /home/dir/syslog.$i.Z ]]; then
mv /home/dir/syslog.$i.Z /home/dir/syslog.$j.Z

# Move current file to first, create new syslog.log, and restart syslogd.
mv syslog.log syslog.1
touch /var/adm/syslog/syslog.log
kill -HUP `cat /var/run/`

# Compress old file and exit.
compress syslog.1

Hope this helps,