I have a system where a cron job is used to drive a manage.py command every minute.  The trouble is, the job can sometimes take longer than a minute, and it's not safe for two instances of the command to run at once.  Is there a good way to make the command detect if another instance of itself is already running and exit early? Is there a better way to achieve the same end?
58542
Is there a Pythonic way to have only one instance of a program running?   The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this?    (Take into consideration that program is expected to fail sometimes, i.e. segfault - so things like "lock file" won't work)
120107
I have created a ruby script file that checks the connection present or not. For example checking port 22 is opened or not.  Firstly I tried with cron job as follows  @reboot find ${HOME}/my_app/check_conn.rb   But it is executing immediately after starting the system.  Now I have to run this script after 5 or 10 min.  How can I do this. Is there any other way for doing this.  Thanks in advance.
90844
How can I prevent (certain cronjobs) from filling my syslog in Ubuntu 15.04? I have some jobs that run 4 times a minute and quickly fill up my syslog files.  I've tried adding:  cron.*                                                  /var/log/cron   to /etc/rsyslog.conf, but this didn't resolve anything.  The current output is:  Aug  8 06:58:01 elitegameservers CRON[25706]: (gijs) CMD (   sleep 15; unison -batch /var/www ssh://server1//var/www) Aug  8 06:58:01 elitegameservers CRON[25703]: (gijs) CMD (   sleep 30; unison -batch /var/www ssh://server2//var/www) Aug  8 06:58:01 elitegameservers CRON[25708]: (gijs) CMD (unison -batch /var/www ssh://server2//var/www) Aug  8 06:58:01 elitegameservers CRON[25713]: (gijs) CMD (   sleep 30; unison -batch /var/www ssh://server1//var/www) Aug  8 06:58:01 elitegameservers CRON[25714]: (gijs) CMD (   sleep 45; unison -batch /var/www ssh://server1//var/www) Aug  8 06:58:01 elitegameservers CRON[25717]: (gijs) CMD (   unison -batch /var/www ssh:// server3//var/www) Aug  8 06:58:01 elitegameservers CRON[25719]: (gijs) CMD (   sleep 15; unison -batch /var/www ssh:// server3//var/www) Aug  8 06:58:01 elitegameservers CRON[25690]: (CRON) info (No MTA installed, discarding output) Aug  8 06:58:01 elitegameservers CRON[25694]: (CRON) info (No MTA installed, discarding output) Aug  8 06:58:08 elitegameservers CRON[25588]: (CRON) info (No MTA installed, discarding output)
27105
On the CLI, sometimes a command I type takes a while to complete, and sometimes I know when that's about to happen. I'm a bit confused on "backgrounding" and such in Linux.  What is the most common (or user-friendly way) of telling the CLI that I don't want to wait, please give me back my prompt immediately. And if it could give me a progress bar or just busy-spinner, that would be great!
91218
I have a command that I want to have run again automatically each time it terminates, so I ran something like this:  while [ 1 ]; do COMMAND; done;   but if I can't stop the loop with Ctrl-c as that just kills COMMAND and not the entire loop.  How would I achieve something similar but which I can stop without having to close the terminal?
12229
How can I check if an application is running from a batch (well cmd) file?  I need to not launch another instance if a program is already running. (I can't change the app to make it single instance only.)  Also the application could be running as any user.
96679
I'm running on a couple of different Linux distros (Fedora 11, CentOS 5 and SuSE 10.2) and  often run into a problem where a new script that I want to run as a cron job works fine when called direct from the command line, but fails when called from cron due to slight variations in the PATH or other required environment variables.  Is there a way I can test run an individual script as if it's being run from cron, without having to run the entire crontab or use run-parts to run the entire cron.daily/ .hourly etc. directory ?  I guess I could temporarily edit my crontab to run the script in the next couple of minutes, but I'd rather have a more standalone solution so that I don't risk messing up the crontab.
42569
Which methods exist to keep a command that was started from shell on running after logging out from from shell?
42578
Am trying to create a cron job to open a web page at a scheduled time.   I have edited my cron using crontab -e and append my job.  I wrote my job in a script like this: xdg-open (URL)  I saved this script in my /home/flicker directory.   However, when I edit my cron (crontab -e), it saves the file as /tmp/crontab.tIzXBv/crontab.   After saving it successfully says installing new crontab.   I made my file script executable, but still failing to handle the job.  I wanted the script to run at 14:30PM, so I added this line to my crontab:   30 14 * * * /home/flicker/open-web.sh   This is still failing to work please help. Here is my script below:  #!/bin/bash xdg-open https://www.google.com
118452
I have a long running BASH script that I am running under CYGWIN on Windows.  I would like to limit the script to run for 30 seconds, and automatically terminate if it exceeds this limit. Ideally, I'd like to be able to do this to any command.  For example:  sh-3.2$ limittime -t 30 'myscript.sh'   or   sh-3.2$ limittime -t 30 'grep func *.c'   Under cygwin the ulimit command doesn't seem to work.   I am open to any ideas.
93360
I'm trying to run a command at 10 minutes after 2am every weekday only.  In my launchd .plist file, how can I specify this?    I don't want it to run every 2 hours and 10 minutes, just once every weekday at the specified time.
100712
I created a cron job using * */2 * * * schedule. Can anyone tell me what schedule this refers to?  I guess it should execute every 2 hours, but it seems to execute every minute.
273
I'd like to run a command at startup which pings a certain address every 10 minutes and writes the result to a file. I've figured out now how to do the pinging and file writing and the 10 min intervals:  while true; do my-command-here; sleep 600; done   My question is, can I put this in /etc/init.d/rc.local or should I be putting it in /etc/rc.local or somewhere else entirely? I'm specifically concerned because it's an infinite loop so I'm not sure if I could put it in one of these startup scripts.  Some help would be appreciated. I'm using Ubuntu 12.04.5
77159
I have a job that I would like to "daemonize" on Unix: I want it to come up when the computer boots, and I want it to restart if it goes down.  A simple way to do this is to setup a cronjob that runs every 10 or 20 minutes. The cronjob should restart the application if it's not already running.  How do I write this last part of the script: "If the job is not currently running, then start the job"?
67791
I have about a dozen Linux boxes that I occasionally need to run the same command(s) on. Is there an easier way (or automated way) to do this asides from logging on to each machine and running the command, one at a time? It's not the same commands all the time and it's not at a preset time so it's not something ideal for tools like cron.
32645
I want to verify that my cron job is executing and at what time.  I believe there is a log for my sudo crontab -e jobs, but where?      I searched google and found recommendations to look in /var/log (in which I do not see anything with 'cron' in the name) and to edit the file /etc/syslog.conf which I also do not have.
51077
I run a job every minute to reindex my site's content.   Today, the search engine died, and when I logged in there were hundreds of orphan processes that had been started by cron.  Is there another way using some kind of existing software that will let me execute a job every minute, but that won't launch another instance if that job doesn't return (i.e. because the search engine process has failed)?