Solved

Delay Startup Cron

Posted on 2008-10-25
9
1,116 Views
Last Modified: 2013-12-16
We're having a problem with an Ubuntu 6.06.2 box that needs to issue a shorewall restart about 1 minute after boot.  We have the cron set to normal run on boot but this is too early as other software hasn't started yet that we have shorewall plugging into.  Need some help.
0
Comment
Question by:cybersharks1
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
can you check in the crontab job to see if the other software has started or not?
0
 
LVL 12

Expert Comment

by:hfraser
Comment Utility
If you're waiting for a process to start, you can check for the process name's existence using "ps".

If you're waiting for a process to reach some particular state (ie. accepting inbound connections), it's common to watch the process's log file for some status message like "Accepting connections".

What condition are you waiting for?
0
 
LVL 9

Expert Comment

by:chingmd
Comment Utility
If the job needs to run at boot. but not at other times, why use cron?

Why not run a use an rc.local entry.    The first command of the script can be to sleep for X amount of time.   This will allow the rest of the programs to run and settle before continuing.

0
 
LVL 3

Expert Comment

by:Saranyakkali
Comment Utility
1. check thefile permissions
2. Check the log files (cron)
3. Timezone settings.


thanks
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:cybersharks1
Comment Utility
It is a wireless router and it needs to wait for the DSL connection to reach a steady state to start sending traffic otherwise it doesn't know how to route the wireless traffic in/out of the Internet.  The box boots quicker than the sync does so shorewall needs to be rebooted after the fact.  I'd be happy to use rc.local but I don't really know how to make a script or use it.  I've very basic when it comes to Linux knowledge, Google hasn't been much help on this.
0
 
LVL 12

Expert Comment

by:hfraser
Comment Utility
OK. What problem are you seeing that you're trying to resolve? Shorewall manages firewall rules, which shouldn't care of the interface is up yet. Perhaps there's an easier way to solve this.
0
 
LVL 9

Assisted Solution

by:chingmd
chingmd earned 50 total points
Comment Utility
If he's using a DSL card, the interface may not even exist yet.  And Shorewall may be throwing errors.

Untested Code Alert!

#!/bin/sh

/path/to/sleep 60
/path/to/and/full/command/line/to/start/shorewall

###  end of code  


0
 
LVL 7

Accepted Solution

by:
macker- earned 75 total points
Comment Utility
Basically, look to see if you have a file named /etc/rc.d/rc.local

If you do, edit it as root in vi or pico, etc. - make sure it's a Unix text editor, and you're not FTP'ing the file to edit in Notepad

Whatever command you have in crontab, you should probably remove from there, and put in the rc.local; provide it here, so it can be reviewed.

At the end of rc.local, you'd add something like what chingmd wrote, but minus the #!/bin/sh part
0
 

Author Closing Comment

by:cybersharks1
Comment Utility
After setting up the rc.local script it worked like a champ, thanks!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now