Solved

Automatic script in Solaris to reload configuration

Posted on 2003-10-23
14
524 Views
Last Modified: 2013-12-27
Hey all~

I'm trying to create a script of some sort on my Solaris box to automatically "kill -HUP 12531" every 15 minutes or so.  Any suggestions on how I can do this?

We're running SunOS 5.9, primarily using the bash shell.

I'd appreciate some help!
0
Comment
Question by:magitek
  • 7
  • 6
14 Comments
 
LVL 18

Expert Comment

by:liddler
ID: 9607365
either
#!/bin/bash
while true
do
kill -HUP 12531
sleep 900
done


or edit your cron (crontab -e) and add
0,15,30,45 * * * * kill -HUP 12531
0
 

Author Comment

by:magitek
ID: 9607440
tried the first option, got back:

bash-2.05# ./autoconf
./autoconf: bad interpreter: Permission denied

I am running the script as root user

Please advise! Thanks!
0
 
LVL 18

Expert Comment

by:liddler
ID: 9607531
ok,
path to bash is wrong.
Either replace #!/bin/bash with #!/bin/sh
or type
which bash
and make the line #!/path/to/bash
0
 
LVL 18

Expert Comment

by:liddler
ID: 9607554
BTW I wouldn't use the name autoconf, it is already a Solaris program.  What about autoconf.sh ?
0
 
LVL 7

Expert Comment

by:glassd
ID: 9607612
Just a small point. Why use bash rather than ksh for such a simple script. Bash is twice the size of ksh and is less efficient.
0
 

Author Comment

by:magitek
ID: 9607643
did the which bash and replaced it with the proper #!/usr/bin/bash

but, it still gives me the error.  (and I did change the name now to autoconf.sh, thanks)
0
 
LVL 18

Expert Comment

by:liddler
ID: 9607695
best bet then change it to #!/bin/sh or #!/usr/bin/ksh as glassd says, they're fine for this script
if your type
kill -HUP 12531
do you get an error message?
 If it is still a problem paste the entire script here and the error message
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:magitek
ID: 9607754
kill -HUP 12531 works just fine.  (i've been having to do it every 15-30 minutes, pain in the behind!)

Just the script gives the error and I don't know why.  Here's what I've got now...


#!/usr/bin/ksh
while true
do
kill -HUP 12531
sleep 900
done

Is there a specific location this script needs to be located in?

(i appreciate all your help.  our network tech passed away this last weekend leaving me to put the pieces back together....me who hadn't touched unix in almost 2 years.  bah)
0
 
LVL 18

Expert Comment

by:liddler
ID: 9607766
no any location,
what is the exact error?
Do you have any blank lines at the top of the file (remove them)
what is the permissions on the script? (ls -l autoconf.sh)
0
 

Author Comment

by:magitek
ID: 9607798
The reply from the permissions:
-rw-r--r--   1 root     other         60 Oct 23 10:51 autoconf.sh

no blank lines.

exact error:

bash-2.05# ./autoconf.sh
bash: ./autoconf.sh: bad interpreter: Permission denied
0
 
LVL 18

Expert Comment

by:liddler
ID: 9607815
Ah! the file is nor executable
chmod +x ./autoconf.sh
0
 

Author Comment

by:magitek
ID: 9607839
Thanks! That got it to work!

One more easy question, then you get your points :-D

How can I keep that running in the background so I don't have to keep a term open with it running?

0
 
LVL 18

Accepted Solution

by:
liddler earned 250 total points
ID: 9607859
I was about to suggest you do that..but I was waiting to see if it worked!

nohup ./autoconf.sh &
0
 

Author Comment

by:magitek
ID: 9607987
THANK YOU!!!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to check for shares on aix 1 63
How to Change Interface on Cisco IOU 11 83
AIX 5.x set up arrow to recall 11 46
add some character at the end of line in vi 7 59
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now