Friday, June 21, 2013

@reboot jobs will be run at computer's startup.

"@reboot jobs will be run at computer's startup."
What on earth does that mean?

These days RedHat use cronie as the system cron daemon. Described as 'based on the original cron' I think it is a fork of vixi-cron which was used until EL5.

For some time, both of these cron daemons have had an @reboot syntax which allows you to run scripts at (more or less) boot time (when the cron daemon is started). This allows users to start long running processes without the sysadmin having to write an initscript.

It also happens that from time to time, the cron daemon crashes. This is not ideal because cron is the very tool which can be used to periodically confirm that a daemon has not crashed. For now I have added a check to puppet to ensure that the cron daemon is running.

When the cron daemon is started, it logs some messages, one of which is the cryptic:
@reboot jobs will be run at computer's startup.
message. I understand that it is trying to tell me something but it fals short of conveying the message. The internet did not have much to say on the topic either so I had to resort to the source code.

The source of the message is from within the run_reboot_jobs function. The function first checks the existence of a (so called) lock file. The file is
/var/run/cron.reboot
If this file is present, the message is printed out and none of the @reboot jobs are run. If the file is absent, it is created and then the @reboot jobs are queued up to be run.

Perhaps the message should read:
Lock file /var/run/cron.reboot present. @reboot jobs have already been run. skipping.

So that is the mystery almost solved. The remaining details are that during boot, the rc.sysinit script removed a number of stale lock files, including the contents of /var/run. This ensures that at boot time, the cron daemon runs the @reboot jobs.

If you wanted to re-run the @reboot jobs without rebooting your server, you can easily trick it with:
rm /var/run/cron.reboot
service crond restart

Perhaps that could also be added to the init script so you run
service crond restart-boot




8 comments:

  1. I am genuinely thankful to the holder of this web page who has shared this fantastic paragraph at here. The innovative communication skills are absolutely necessary in the cutting edge environment these days; the will enhance the level of competency. Go through with this site: Write my Essay

    ReplyDelete
  2. Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. Worldtalentjobs

    ReplyDelete
  3. This is not an error. It only indicates that your server has probably been restarted and your Cron daemon is running the jobs scheduled with a

    homepage

    ReplyDelete
  4. Thank you for your share the best post with me!
    the impossible game

    ReplyDelete
  5. Often described as the "best actress of her generation", Meryl Streep net worth is particularly known for her versatility and accents. Her accolades include a record 21 Academy Award nominations, winning three, and a record 32 Golden Globe Award nominations, winning nine. Streep made her stage debut in Trelawny of the Wells and received a Tony Award nomination for 27 Wagons Full of Cotton and A Memory of Two Mondays in 1976. In 1977, she made her film debut in Julia. In 1978, she won a Primetime Emmy Award for her leading role in the miniseries Holocaust, and received her first Oscar nomination for The Deer Hunter. Streep won the Academy Award for Best Supporting Actress for playing a troubled wife in Kramer vs. Kramer (1979) and went on to establish herself as a film actress in the 1980s. She won the Academy Award for Best Actress for starring as a Holocaust survivor in Sophie's Choice (1982) and had her biggest commercial success to that point in Out of Africa (1985). She continued to gain critical and awards recognition for her work in the late 1980s and 1990s, but commercial success was varied, with the comedy Death Becomes Her (1992) and the drama The Bridges of Madison County (1995), becoming her biggest earners in that period.
    Meryl Streep reclaimed her stardom in the 2000s and 2010s with starring roles in Adaptation (2002), The Hours (2002), The Devil Wears Prada (2006), Doubt (2008), Mamma Mia! (2008), Julie & Julia (2009), It's Complicated (2009), Into the Woods (2014), The Post (2017) and Little Women (2019). She also won her third Academy Award for her portrayal of British Prime Minister Margaret Thatcher in The Iron Lady (2011). Her stage roles include The Public Theater's 2001 revival of The Seagull, and her television roles include two projects for HBO, the miniseries Angels in America (2003), for which she won another Emmy Award, and the drama series Big Little Lies (2019).
    Meryl Streep is one of the most widely known and acclaimed actors in history. Ms. Streep has captured our imaginations with her unparalleled ability to portray a wide range of roles and attract an audience that has only grown over time, portraying characters who embody the full range of the human experience.

    ReplyDelete