Register
It is currently Tue Nov 25, 2014 5:09 pm

Runlevel Check


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Sun Nov 08, 2009 7:43 pm   

Joined: Sun Nov 08, 2009 7:38 pm
Posts: 3
i need to be able to check current runlevel in my script to determine what runs next. I have no idea how to do this.
Any help would be appreciated.


Top
 Profile  
 PostPosted: Sun Nov 08, 2009 8:15 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 569
man runlevel

what else?


Top
 Profile  
 PostPosted: Mon Nov 09, 2009 3:19 am   

Joined: Sun Nov 08, 2009 7:38 pm
Posts: 3
I am aware of that and I have read it. I just am unsure how to apply that in a bash script.
I want to have it check if the computer is at runlevel 5 or 3. If at 5 then start of beginning
of script. If at runlevel3 then skip to a lower part of script.


Top
 Profile  
 PostPosted: Mon Nov 09, 2009 3:24 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
Code:
if [ "$(runlevel | awk '{ print $2 }')" -eq 2 ]
then
  echo this is runlevel 2
fi


Top
 Profile  
 PostPosted: Mon Nov 09, 2009 3:43 am   

Joined: Sun Nov 08, 2009 7:38 pm
Posts: 3
thank you! I beleive I can make that work.
Sorry if i seem so newbie


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP