The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Xwindows wont start frankkahle UNIX for Advanced & Expert Users 1 07-26-2007 04:29 AM
AIX 5.3: Start Service on System startup dennis.kuehl UNIX for Advanced & Expert Users 1 07-25-2006 03:32 AM
SMC wont start wjseaman SUN Solaris 0 11-15-2005 06:07 PM
how do i auto start application upon startup? doofie UNIX for Dummies Questions & Answers 2 04-01-2004 09:20 AM
Apache wont start Alpha_Harblo UNIX for Dummies Questions & Answers 4 01-02-2002 09:26 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-05-2006
msearson1 msearson1 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 3
startup script wont start up

I've put this script in /etc/rc.d and made a symbolic link to it from S99pctb in /etc/rc.d/rc3.d but it wont start up. Anyone know why ?

This is the script:

---------------------------
#!/bin/sh
c=1

case "$1" in
start)
echo -n "starting pctb ..." > /etc/logger
while [ $c -lt 10 ]; do
x=`/bin/date -u +%k`
y=`expr $x + 1`

case $y in
0|1|2|3|4|5|6) /sbin/shutdown -h "now";;
*);;
esac

/bin/sleep 5

done
;;

stop)
;;
esac
--------------------------------------------------

Marcus.
  #2 (permalink)  
Old 11-05-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
What exactly do you want to do in this script? It looks like you are trying to shutdown the system if the time is between 0100 to 0700 UTC you want to shutdown and halt the system.
Is that what you really want?

Also, are you sure that your script is actually running? Maybe you could have the script echo something to a file in the / directory right at the start to make sure of that.
  #3 (permalink)  
Old 11-05-2006
msearson1 msearson1 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 3
doesn't start up

That's right. i want to make the machine unavailable at night.

I've tried echoing to a file at the start, and it doesnt happen so it seems that the script just isn't starting at all.
  #4 (permalink)  
Old 11-05-2006
funksen funksen is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 430
if you want to shut the system down when its between 1 and 7 o'clock, you should rather make a cronjob an run it every half our

then you have a chance to stop it in case you try to start the machine for any reason in the night

if you are the only person that uses this machine, rather make something like

0 0 * * * /sbin/shutdown -h now >> /etc/logger 2>&1

in /etc/crontab

why do you use arguments? when you don't want to start the script simply don't run it I'm confused ^^
  #5 (permalink)  
Old 11-05-2006
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
Since the script only works when the system is powered up, I think he wants the system to power back off if someone happens to turn it on after he's gone home.

Two things to look for. Is the script executable? Is run level 3 your system init level. Check /etc/inittab and see what your init:3:initdefault line is set to. If the number is '2', then you aren't getting to run level 3 and the script won't run.

Solaris (for example) goes through the run levels until it reaches the one set with init. So if inittab is set to run level 3, it runs through 2 running scripts and then processes scripts in 3.

Linux reads the run level and goes directly to the rc directory and processes the scripts. So you need to have links in each of the directories (rc2.d and rc3.d for example).

So if it's linux and the inittab is pointing to run level 5 as the initdefault, you'll need to link the script into /etc/rc5.d.

Carl
  #6 (permalink)  
Old 11-05-2006
hegemaro hegemaro is offline
Registered User
  
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 134
May I suggest simply bringing down the network interface rather than shutting down the system? Then, in the morning, bring it back online. This, of course, does not prevent console access but, quite frankly, shutting down the box doesn't either (it just takes longer).
  #7 (permalink)  
Old 11-05-2006
msearson1 msearson1 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 3
Resolved

Many Thanks to all for the input. In the end I used the easiest method. I put * * * * * in the crontab file to run the command every minute.

Is there something I need to do to register this thread as resolved ?
Marcus.
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0