Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Script should keep running only at specific time Post 303045209 by Syedsabeel on Friday 13th of March 2020 01:59:22 PM
Old 03-13-2020
Script should keep running only at specific time

I want a script to run once at 6:00AM, keep running, and then STOP running at 23:59PM.

Hi,
Can we use crontab and can you write one example where the script will run only in between 6am to 00 daily.

Last edited by vbe; 03-14-2020 at 08:17 AM.. Reason: re posted under another form...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ending script at specific time.

Hello Everybody.. I've written the script that kick off through CRON job and kill itself by specific time. I've start time and end time specify in env file. i.e START_TIME=1500 (03:00 PM) END_TIME=0600 (06:00 AM) It always works good if my START_TIME is before midnight and my... (4 Replies)
Discussion started by: nirav_soni
4 Replies

2. Shell Programming and Scripting

Running batches of files at a time from a script

Hi I have a script that performs a process on a file. I want to know how to include a function to run a batch of files? Here is my script #!/bin/bash #---------------------------------------------------------------------------------------------------------------------- #This... (2 Replies)
Discussion started by: ladyAnne
2 Replies

3. Emergency UNIX and Linux Support

Help to optimize script running time

Dear Forum experts I have the below script which I made to run under bash shell, it runs perfectly for low records number, let us say like 100000. when I put all records (3,000,000), it's takes hours can you please suggest anything to optimize or to run in different way :-| {OFS="|";... (6 Replies)
Discussion started by: yahyaaa
6 Replies

4. Shell Programming and Scripting

Help in running a script after a particular time

Unix Gurus, I have a requirement where the shell script needs to do specific tasks after certain period of time. Daily we receive few files in a particular folder. The script does the file renaming, pass parameters to run some web services and pushes to remote FTP location. But my... (3 Replies)
Discussion started by: shankar1dada
3 Replies

5. Shell Programming and Scripting

How to know the exact running time of script!

Hi All, newbie here, I'm just wondering how can i know the exact running time of my script? Please advise, THanks, (1 Reply)
Discussion started by: nikki1200
1 Replies

6. Shell Programming and Scripting

script for get lines with specific time.

i want to make a script for grep any lines with key word and every time (5 min) Ex. Log in Server. . . . 03-01-2012 03:07:54,924 - INFO MessageUtil - Return | Status=0 | TxID=12010300000548755292 | Message=Success 03-01-2012 03:09:13,789 - INFO MessageUtil - Return | Status=0 |... (6 Replies)
Discussion started by: ooilinlove
6 Replies

7. Shell Programming and Scripting

Help with kill a specific process after certain running time

Hi, Do anybody experience to write a bash script in order to kill a specific process (java) after certain time of running? eg. java java.jar task_run.txt I will run a java program (java.jar) which will run a long list of process (task_run.txt) one by one. I plan to terminate the java... (5 Replies)
Discussion started by: perl_beginner
5 Replies

8. Shell Programming and Scripting

Setting time for running of the script

Dear all, I wonder if it is possible that we can run the script from time to time..I meant, it should repeat the sourcing of the script by itself? In my case, I need to source this script manually from time to time, like once in every 10 minutes. emily, (2 Replies)
Discussion started by: emily
2 Replies

9. Shell Programming and Scripting

Example of running script with time limits?

Hi, I want to write a script that does some sort of health check on the database. It will query the database for information, some query takes long and some are quick. For example, inside the script I will do something as below: #!/bin/ksh run_query_01 & run_query_02 &... (1 Reply)
Discussion started by: newbie_01
1 Replies

10. Shell Programming and Scripting

Running script in crontab in a specific directory

I am trying to run a script from crontab but the entire script (which is 70+ lines) is written in bash and I need it to run from a certain directory. So when I run it manually I cd to /local/mnt/scr and then type ./reordersc and it works fine. However, I want it to run from the crontab and I... (20 Replies)
Discussion started by: newbie2010
20 Replies
ANACRONTAB(5)							   File Formats 						     ANACRONTAB(5)

NAME
/etc/anacrontab - configuration file for Anacron DESCRIPTION
The /etc/anacrontab configuration file describes the jobs controlled by anacron(8). It can contain three types of lines: job-description lines, environment assignments, or empty lines. Job-description lines can have the following format: period in days delay in minutes job-identifier command The period in days variable specifies the frequency of execution of a job in days. This variable can be represented by an integer or a macro (@daily, @weekly, @monthly), where @daily denotes the same value as the integer 1, @weekly the same as 7, and @monthly specifies that the job is run once a month, independent on the length of the month. The delay in minutes variable specifies the number of minutes anacron waits, if necessary, before executing a job. This variable is repre- sented by an integer where 0 means no delay. The job-identifier variable specifies a unique name of a job which is used in the log files. The command variable specifies the command to execute. The command can either be a command such as ls /proc >> /tmp/proc or a command to execute a custom script. Environment assignment lines can have the following format: VAR=VALUE Any spaces around VAR are removed. No spaces around VALUE are allowed (unless you want them to be part of the value). The specified assignment takes effect from the next line until the end of the file, or to the next assignment of the same variable. The START_HOURS_RANGE variable defines an interval (in hours) when scheduled jobs can be run. In case this time interval is missed, for example, due to a power down, then scheduled jobs are not executed that day. The RANDOM_DELAY variable denotes the maximum number of minutes that will be added to the delay in minutes variable which is specified for each job. A RANDOM_DELAY set to 12 would therefore add, randomly, between 0 and 12 minutes to the delay in minutes for each job in that particular anacrontab. When set to 0, no random delay is added. Empty lines are either blank lines, line containing white spaces only, or lines with white spaces followed by a '#' followed by an arbi- trary comment. You can continue a line onto the next line by adding a '' at the end of it. In case you want to disable Anacron, add the 0anacron cron job (which is a part of crontab(1)) into the /etc/cron.hourly/jobs.deny direc- tory. EXAMPLE
This example shows how to set up an Anacron job similar in functionality to /etc/crontab which starts all regular jobs between 6:00 and 8:00 only. A RANDOM_DELAY which can be 30 minutes at the most is specified. Jobs will run serialized in a queue where each job is started only after the previous one is finished. # environment variables SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root RANDOM_DELAY=30 # Anacron jobs will start between 6am and 8am. START_HOURS_RANGE=6-8 # delay will be 5 minutes + RANDOM_DELAY for cron.daily 1 5 cron.daily nice run-parts /etc/cron.daily 7 0 cron.weekly nice run-parts /etc/cron.weekly @monthly 0 cron.monthly nice run-parts /etc/cron.monthly SEE ALSO
anacron(8), crontab(1) The Anacron README file. AUTHOR
Itai Tzur <itzur@actcom.co.il> Currently maintained by Pascal Hakim <pasc@(debian.org|redellipse.net)>. For Fedora, maintained by Marcela Malaova <mmaslano@redhat.com>. cronie 2012-11-22 ANACRONTAB(5)
All times are GMT -4. The time now is 04:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy