Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 938625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:40:26+00:00 2026-05-15T21:40:26+00:00

I want to create cron job that runs a script every 5 seconds. Seeing

  • 0

I want to create cron job that runs a script every 5 seconds. Seeing that cron jobs only allows increments of minutes 0-59 and so on.

I thought to create another script that calls my original script written below.

#!/bin/bash

while true
do
# script in the same directory as this script. is this correct?
bash makemehappy.sh
sleep 1
done

I now, need to know how to run this script every time i boot my computer and for it to start itself if it isn’t running for some reason.

I am also aware that running this script every minute wouldn’t be a good thing. 🙂

if there is an easier way to run a script every 5 seconds please advise.

Please and thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:40:27+00:00Added an answer on May 15, 2026 at 9:40 pm

    I wouldn’t use cron for this. I would use that bash script (use an absolute path, unless you want it to be portable and know that the directory structure will be preserved).

    Instead, I would just sleep 5, just like you did (only 5 seconds instead of 1).

    As far as starting it with your system, that depends on the system. On (some) Linux distros, there’s a file called /etc/rc.local in which you can add scripts to run when the system starts. Well… I shouldn’t be so general, the distros that I have used have this. If you’re running Ubuntu, there is no longer an inittab, they use upstart, btw.

    So if you have an endless loop and an entry in /etc/rc.local, then you should be golden for it to run endlessly (or until it encounters a problem and exits).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cron job that runs every hour. It accesses an xml feed.
I want to create a web application that allows users to sign up, register
In my Zend framework Project I want to create a Cron Job . I.e.,
I want to create cron jobs from within PHP, a bit like in cPanel
I want to create a function that performs a function passed by parameter on
I want to create a simple http proxy server that does some very basic
Every time that I want to do a Layout, I'm getting a black layout
I would like to call a cron job from within a PHP script. I
I write a shell script below to add a job to cron. #!/bin/sh touch
I am writing a series of cron jobs. I want each task to log

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.