I need my server to reboot after every 5 days of uptime
if it is not rebooted and again reboot after exactly 5 days and continue this process consecutively.
I would like to know how to do this with cronjob or any other script
You can use the dow, or Day of Week, part of the crontab syntax, to execute the command on every occurrence of a particular day, using numbers in the form:
0-6 Sunday to Saturday
1-7 Monday to Sunday
Or even shortened word notation such as WED or THU for Wednesday or Thursday
# m h dom mon dow command
00 07 * * 5 your-command-here
The example above would run the command at 7:00 am every Friday
Related
I am using postgres and wondering how I should store schedule time blocks in a way that allows me to do the following:
If I have a schedule with 3 time blocks:
Monday 8am to 12pm
Monday 10am to 4pm
Thursday 8am to 12pm
And I am trying to find all schedules between Monday and Wednesday that start at 8am.
I am storing the time_blocks as array, and I am not sure how to query them.
I suggest three columns:
dow - Day of the week as integer or string. Either would work, integer is best for storage and performance. (0 - 6; Sunday is 0)
from - time type, time of day
to - time type, time of day
Then you can select this way:
SELECT
*
FROM
"schedule"
WHERE
-- Mon, Tue, Wed
"dow" IN (1,2,3) AND
'08:00:00'::time = "from"
You could search for 8am or earlier this way:
'08:00:00'::time BETWEEN "from" AND "to"
I use SQL Server 2017. I need to schedule a job to run at 12am and 12pm for each days between 7th and 27th of each months. In the other word, i need to run my job two times per day between two date in each month.
Can i do that in one schedule task or I have to create a two jobs for each exact day?
12 am 7th month
12 pm 7th month
and so on and so on.
If i have to create a job for each hover of each day i will have several schedule.
Update 1: I did it by creating several steps in schedule tab but i am looking to do that in less steps.
Update 2:
If i can create two steps like below it will good for me.
1 : Occurs every month between 7th and 27th at 12 am
2 : Occurs every month between 7th and 27th at 12 pm
One way to do that is to check if the date is in between 7th and 27th using DATENAME or DATEPART.
--IF (DATENAME(DAY, GETDATE()) >= 7 AND DATENAME(DAY, GETDATE()) <= 27)
IF DATEPART(DD, GETDATE()) BETWEEN 7 AND 27
BEGIN
EXEC [Your Stored Procedure]
END
And then set the Daily frequency to start at 12:00 AM and Occurs every 12 hours.
I have a couple of scenarios
Scheduler should compare the current day is with in the last 10 business days of the current month then it should schedule to run current day with 11AM CST.
(E-g) current day : 18th July 2017 (with in last 10 business days) should run and reschedule at 19th July 2017 11.AM CST
IF Last business day(30th or 31st) after runs the scheduler should reschedule it to next month.
(E-g )current day : 31th July 2017 (with in last 10 business days) should run and reschedule at 18th Aug2017 11.AM CST
Can any one help to derive the logic in oracle 11g scheduler?
Thanks in Advance.
I want to create a basic case logging system and when somebody opens a new issue, the issue is assigned a Sr_number with a given number of hours. For example Sr_number 1 is 4 hours, 2 is 6 hours, 3 is 8 hours and 4 is 24 hours.
Now adding hours onto a time stamp is easy but the catch is I need to take into account working hours which are 09:00 to 17:00 Monday to Friday.So if a case is given a 12 hour Sr_number and the deadline for this falls at 16:00 on a week day then the deadline is extended to the next working day. Basically the deadline is 12 working hours.And calculation should be 1 hour worked for the issue logged on same day and remaining 11 hours to next working day.
If in case it is sun, it should consider directly go to monday.
Example:
Case created on: 10/06/2015 12:04:39 PM- with Sr_number 1 (12 Hours) Deadline is now: 10/07/2015 12.05 PM
Make sense?
Another catch is I need to take into account hours On Hold and these two have to be only within working hours.
For some case,saturdays is working ,for some its holiday.
How should i proceed.
I tried performing datepart,dateadd and datediff functions.But i could find only weekday.
I am new at sql.Please guide for the same
I have a SQL job set up to run once every 12 hours everyday -at 7AM and 7PM. The job only runs at 7PM everyday but not the next day morning.
Can you help me and point out the problem please? Thanks!
Schedule Type :Recurring. Enabled.
Frequency-
occurs: Daily
Recurs: 1 Day
Daily Frequency -
Occurs every:12 hours
Starting at 19:00:00
Ending at 20:59:59
Duration-
Start Date :15/11/2013
No End Date
This is what the summary at the end says :
Occurs every day every 12 hour(s) between 19:00:00 and 20:59:59. Schedule will be used starting on 2013-11-15.