- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- unusual problem with shell scripts
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 06:18 PM
07-13-2006 06:18 PM
On my solaris I have 2 scripts...one is very simple just init 6
while the other is more complex..
both scripts work just fine but I have some aplication done on my remote windows and I can not execute init 6 script...but other scripts can be executed..any ides??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 08:03 PM
07-13-2006 08:03 PM
Re: unusual problem with shell scripts
can you please confirm/clarify:
1. These scripts are on a Solaris platform
2. If they are on a Solaris platform, why do you mention remote windows.
3. You say both scripts work fine, but then that you can not execute the init 6 script.
For point 3.: Have you checked the execute permissions with 'ls -l'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 08:39 PM
07-13-2006 08:39 PM
Re: unusual problem with shell scripts
there are 2 ways to reach those scripts both from windows machine:
1. from emulator like putty both scripts work perfect i can restart machine..
2. using php and telenet class I can execute one script but script with init 6 can not be executed..
PHP code is OK I know that...and in all ways I am root.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 08:58 PM
07-13-2006 08:58 PM
Re: unusual problem with shell scripts
I'm shure you can tell us the error message, wen you try to execute that script.
'init 6' is a call for reboot, so:
- what is the name of the script calling 'init 6'
- what else is found in that script?
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 09:21 PM
07-13-2006 09:21 PM
Re: unusual problem with shell scripts
did I get it right that you want from your remote Windows PC (from a browser?) reboot your Solaris server by an init 6 through some sort of CGI script?
So is there a webserver which is supposed to execute the PHP involved?
For security reasons you wouldn't want the webserver on the Solaris box being run as root.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 09:21 PM
07-13-2006 09:21 PM
Re: unusual problem with shell scripts
#!/bin/ksh
responce="US"
if [ $responce == "US" ]; then
# echo "cao"
# ./restart214
init 6
#shutdown -i6 -g0 -y
echo "has not been created">>kFILE
else
echo "$dir has not been created"
fi
if I execute it via putty it restarts machine..and works perfect..
but with PHP I just can not execute this script all others can be executed..
to be more precised:
script
#!/bin/ksh
responce="US"
if [ $responce == "US" ]; then
# echo "cao"
# ./restart214
# init 6
#shutdown -i6 -g0 -y
echo "has not been created">>kFILE
else
echo "$dir has not been created"
fi
can be executed via PHP
so if I put # before init 6 it works even via PHP(telnet from windows) but if I remove # it does not work..
strange...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 09:53 PM
07-13-2006 09:53 PM
Re: unusual problem with shell scripts
- try to catch the error
- call init with pathname
#!/bin/ksh
responce="US"
exec 2>/tmp/shutt.err
if [ $responce == "US" ]; then
# echo "cao"
# ./restart214
/usr/sbin/init 6
#shutdown -i6 -g0 -y
echo "has not been created">>kFILE
else
echo "$dir has not been created"
fi
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 10:10 PM
07-13-2006 10:10 PM
Re: unusual problem with shell scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 11:28 PM
07-13-2006 11:28 PM
Re: unusual problem with shell scripts
modify script to get traces:
#!/usr/bin/ksh -x
exec 2>/tmp/shutt.err
responce="US"
if [ $responce == "US" ]; then
echo "ciao"
# ./restart214
/usr/sbin/init 6
#shutdown -i6 -g0 -y
echo "has not been created">>kFILE
else
echo "$dir has not been created"
fi
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2006 12:01 AM
07-14-2006 12:01 AM
Re: unusual problem with shell scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2006 02:34 AM
07-14-2006 02:34 AM
Re: unusual problem with shell scripts
if you really have added the 1st+2nd line of the script to
#!/usr/bin/ksh -x
exec 2>/tmp/shutt.err
and do not get anything then your script must terminate before the next statement. This example
cat /tmp/b
#!/usr/bin/ksh -x
exec 2>/tmp/tstout
a=5
produces this output file:
cat /tmp/tout
+ a=5
Buildup a testscript like
#!/usr/bin/ksh -x
exec 2>/tmp/tstout
echo start >/dev/stderr
/usr/sbin/init 6
echo $?
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2006 03:04 AM
07-14-2006 03:04 AM
Re: unusual problem with shell scripts
Does init require a valid session to be used? I know it uses pam for session management.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2006 06:10 PM
07-17-2006 06:10 PM
Re: unusual problem with shell scripts
I tried what peter told..I got in my shutt.err this:
+ echo has not been created
+ 1>> /opt/tomcat/logs/meme/crFILE
+ init 6
and I executed this:
#!/bin/ksh -x
exec 2>/opt/tomcat/logs/meme/shutt.err
echo "has not been created">>/opt/tomcat/logs/meme/crFILE
init 6
and again solaris is not being restarted..
but again if I execute this script from command line solaris restarts...
can anyone figure what might be my problem...:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2006 07:39 PM
07-17-2006 07:39 PM
Re: unusual problem with shell scripts
as I and you see, you
- do not have entered the full pathname /usr/sbin/init 6
in your script, but only 'init 6'
- you do not have setup the check for the exit-status of that command
- a command 'init 6' gets executed
So try EXACTLY that script and tell us the resulting output.
#!/usr/bin/ksh -x
exec 2>/tmp/tstout
echo start >/dev/stderr
/usr/sbin/init 6
echo $?
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2006 08:46 PM
07-17-2006 08:46 PM
Re: unusual problem with shell scripts
cat tstout:
+ echo start
+ 1> /dev/stderr
start
+ /usr/sbin/init 6
but still..solaris stays not restarted..:(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 12:04 AM
07-18-2006 12:04 AM
Re: unusual problem with shell scripts
we see that /usr/sbin/init is called but does not come back again to your script, since no
+ echo NN
is seen in the outout file.
Did the command finish or does it hang at that point?
Best would be not to call a reboot in that way.
Perhaps let an at-job do the work, like
...
echo /usr/sbin/reboot | at now +1 min
...
mfG Peter
PS: My general opinion in case of rebooting is still "do it only when it's necessary and not on a regular base".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 01:11 AM
07-18-2006 01:11 AM
Re: unusual problem with shell scripts
and just another point..considerin that I am doing all this from my windows mach.on it it is apache and PHP is there maybe some restriction on my apache to prevent restart..I mean is it possible that my apache does not allow remote telnet restart ...I doubt..but..who knows..
Once again can U explain me last command reboot and can I use it..THANKS a lot..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 01:15 AM
07-18-2006 01:15 AM
Re: unusual problem with shell scripts
can I just enter that in script..together with this: at now +1 min??
Do U think it is safe enough..sorryy again but I am new in solaris..but would love very much to learn..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 01:16 AM
07-18-2006 01:16 AM
Re: unusual problem with shell scripts
So the orderly shutdown, for example of oracle does not take place with init 6.
See man init and man inittab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 01:36 AM
07-18-2006 01:36 AM
Re: unusual problem with shell scripts
-> shutdown â i6 â g0 -y
-> init 6
-> echo /usr/sbin/reboot | at now +1 min
those "3 restarts"...thanks for explanation..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 02:45 AM
07-18-2006 02:45 AM
Solutionthe line
echo /usr/sbin/reboot | at now +1 min
should be the substitute for
/usr/sbin/init 6
in your script. The at-job submitted will launch a reboot one minute after being scheduled.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2006 09:30 PM
07-18-2006 09:30 PM
Re: unusual problem with shell scripts
echo /usr/sbin/reboot | at now +1 min
worked for me...init 6 did not work but I could restart my system with this command..I just changed my shell script and put that in it...
regards...