Delay Startup Cron

Posted on 2008-10-25
Medium Priority
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.
Question by:cybersharks1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
LVL 40

Expert Comment

ID: 22805853
can you check in the crontab job to see if the other software has started or not?
LVL 12

Expert Comment

ID: 22806104
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?

Expert Comment

ID: 22806306
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.

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.


Expert Comment

ID: 22806552
1. check thefile permissions
2. Check the log files (cron)
3. Timezone settings.


Author Comment

ID: 22807379
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.
LVL 12

Expert Comment

ID: 22807690
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.

Assisted Solution

chingmd earned 200 total points
ID: 22807894
If he's using a DSL card, the interface may not even exist yet.  And Shorewall may be throwing errors.

Untested Code Alert!


/path/to/sleep 60

###  end of code  


Accepted Solution

macker- earned 300 total points
ID: 22837178
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

Author Closing Comment

ID: 31510036
After setting up the rc.local script it worked like a champ, thanks!

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

765 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