LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-15-2012, 10:50 AM   #1
georage
LQ Newbie
 
Registered: Oct 2008
Posts: 4

Rep: Reputation: 0
service started with crontab uses more cpu?


This seems very strange. On a new install of Debian Squeeze I can execute a shell script directly via command line and the service will take about 30 percent cpu. If I make a crontab execute the script, it takes a LOT more cpu (according to top).

#My crontab entry
* * * * * /home/george/NWN/nwn_restart &> /dev/null

The following is the called script ...

Code:
#!/bin/bash
# NWN Server Process Monitor

#Get in the right directory
NWN_DIR=/home/george/NWN
cd $NWN_DIR

# Command to run
RESTART="./nwserver -module Earthspur"

#path to pgrep command
PGREP="/usr/bin/pgrep"

# daemon name
HTTPD="nwserver"

# find pid
$PGREP ${HTTPD}

if [ $? -ne 0 ] # if not running
then
 # restart 
 $RESTART

fi
Once again, I can type ./nwn_restart on the command line and the service uses 30 percent CPU ... if I wait for the crontab to execute the script, top says 152% (on a dual core system)

Thanks for any tips. This is driving me batty.

Last edited by georage; 03-15-2012 at 10:52 AM. Reason: to provide OS info
 
Old 03-15-2012, 03:25 PM   #2
eeekster
Member
 
Registered: Oct 2011
Posts: 163

Rep: Reputation: Disabled
Could it be trying to read stdin?
 
Old 03-15-2012, 05:41 PM   #3
georage
LQ Newbie
 
Registered: Oct 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Solved!

Thanks!

I changed the restart line to use the game server's quiet option, which solved the stdin prob
Code:
RESTART="./nwserver -module Earthspur -quiet"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A crontab notification that emails when a job has started, and stopped. bluesword1969 Programming 2 11-17-2011 04:02 PM
Dansguardian 2.10.0.3 - no service to be started ? TechnoBod Linux - Software 1 02-18-2009 05:41 AM
iptables service not started karimasif Linux - Kernel 0 08-31-2007 08:42 AM
LDAP service is not getting started dhanju Linux - Networking 0 01-06-2006 04:36 AM
Telnet service cannot be started! supermyself Linux - Networking 2 06-09-2005 12:46 PM


All times are GMT -5. The time now is 06:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration