LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-21-2013, 05:36 AM   #1
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 12.04 / CentOS 6.5
Posts: 394

Rep: Reputation: 61
Cron Daemon questions


Hi,

I'm having some problems getting crond to restart my application server. This application server relies on two environment variables exported from /etc/profile. Does crond have access to these environment variables or do I have to define them in the crontab?
Also, I've noticed that a "ps -elf | grep crond" sometimes shows several running crond processes. Does crond spawn child processes for each task it has to perform?

Thanks for any information.
 
Old 08-21-2013, 08:59 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,195
Blog Entries: 10

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by arashi256 View Post
Hi,

I'm having some problems getting crond to restart my application server. This application server relies on two environment variables exported from /etc/profile. Does crond have access to these environment variables or do I have to define them in the crontab?
I usually declare any needed variables in a script and then use that script in a cron.

I believe you can do something like
Code:
env_var1=
env_var2=
00 4 * * * /path/to/your/start_application/binary
or even
Code:
* * * * * export env_var1=x ; export env_var2=y ;  sleep 5s && echo "yo"
and yet, this too may work
Code:
0 5 * * *  ./etc/profile ; /path/to/command/to/run
References:
http://stackoverflow.com/questions/2...ontab-will-use

Others may contribute something I missed (early, no coffee, too much coffee).

Please let us know.
 
Old 08-21-2013, 10:28 AM   #3
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 54
You should put it in a script that way you can also examine the output from the system call to restart your application server and you can then see what the problem.

The variables you need can be set via the script as well.
 
  


Reply

Tags
cron, crond


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
How *accurate* the cron daemon is? ivanatora Slackware 6 03-23-2009 01:53 PM
configuring the cron daemon skylimit Linux - Newbie 9 11-27-2006 01:44 PM
uClinux cron/daemon help Pyrofeed Linux - Newbie 1 02-25-2006 07:22 AM
How does cron daemon work? smart_sagittari Linux - General 5 01-26-2006 09:40 AM
Cron Daemon error? Help please plisken Linux - General 0 08-27-2003 06:57 PM


All times are GMT -5. The time now is 10:51 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