LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 04:36 AM   #1
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Rep: Reputation: 62
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, 07:59 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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, 09:28 AM   #3
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 55
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:35 AM.

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
Open Source Consulting | Domain Registration