Setup cronjobs to different time zones in same server - server

I want to set up cronjobs in the same ubuntu 18 server but for different timezones.
For example, I wanted to send a notification to every UK user at 9 a.m. and the same notification should be triggered to US users at 9 a.m. according to their timezone.
I tried the implementation below but it is not working. Still those notifications are triggered in UTC timezones.
Is there any way to achieve this? 3rd party service is also fine.
CRON_TZ = 'Europe/London'
0 9 * * * curl --silent https://example.com/checkUk
CRON_TZ = 'America/New_York'
0 9 * * * curl --silent https://example.com/checkUs

If you want to set different timezone for your particular cronjob, execute crontab -e via ssh and add
TZ=America/New_York
before every cronjob.
Refer this SO Link which might help you .

Related

Rundeck API - get job schedule

For Rundeck community edition 3.3.10 is there a way of getting a scheduled job's schedule frequency via the API? e.g. if the schedule is 0 20/15 * ? * * * then an API call that will either return this string, or the frequency part of every 15 minutes. I have looked at the job/<ID>/info and job/<ID>/executions endpoints, but I am unable to get the actual schedule frequency.
You can use the Job Forecast API Endpoint. That info is available in the "futureScheduledExecutions" response section.

API request on Atlas mongodb ISO 8601 granularity=Pxxx&period=Pxxx

Trying the below API request to get the CPU usage metric for last 30 days everyday at 10:30 PM.
The below command is working , But on adjusting granularity & period it is giving "errorCode" : "INVALID_PERIOD"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
curl --user "xxxxxxx:yyyyyyy" --digest
--header "Content-Type: application/json"
--include
--request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/gggggg/processes/servername:27017/measurements?m=MAX_PROCESS_CPU_USER&granularity=P1D&period=P30D&pretty=true"
On the web page https://en.wikipedia.org/wiki/ISO_8601 it is giving some formats.
I tried like &granularity=PT1H&period=P2DT1H& and more, but I am not getting the output I am looking for.
My requirement is to get the metrics at 10:30PM every day for last 30 days. Anyone know how can I pass the specific time and 30 days to get the metric out with out error.
Thanks
Thomas

Use a local date in option

I've scheduled a Rundeck (3.3.8) job at 15:00 choosing with my local timezone (Europe/Rome).
In job argument I've set
-lastStartDate ${DATE-1:yyyyMMddHHmmss}
for saying 'one day ago'.
The problem is that DATE is UTC, so when it starts at 3 pm my time, it says LastStartDate=20210425130000 while I need it to be in my local time, so 15.
What can I do?
You can configure Rundeck to use a specific timezone adding -Duser.timezone parameter on the rundeckd file, here you can see how to add the parameter, take a look at this.
In your case would be:
RDECK_JVM_OPTS="-Duser.timezone=Europe/Rome"
And restart the Rundeck service.

Session times out after 5/6 mins - Sails.js

I am having a similar issue. In testing environment it worked just by updating the session.js from config (maxAge:24 * 60 * 60 * 1000) ~ 24hrs.
In Prod it doesn't work at all. After 5/6 mins the application times out the user and you need to log in again.
I have modified http.js by adding a custom middleware just after 'session' middleware.
No luck. I am using sails.js 0.12.14. Really desperate as my application should go live this week.
my http.js

Nagios retry interval when they have OK or UP state

I configure one Linux Host to Nagios Monitoring Server Using NRPE Plugin.
For this I follow the below URL
http://www.tecmint.com/how-to-add-linux-host-to-nagios-monitoring-server/
I have to check some services of Linux Host.
For monitoring linux host and services of that host, I am using nagios log(/usr/local/nagios/var/nagios.log)
First time all good in my nagios log that showing me as below status
SERVICE ALERT: test.testing.local;Service Tomcat;OK;SOFT;6;TOMCAT OK
When my Service status is change to non-OK state than it showing me on log
SERVICE ALERT: test.testing.local;Service Tomcat;CRITICAL;SOFT;4;TOMCAT CRITICAL
But I want that if my Service status is not change to non-OK state than again after 1 minute it show me on log
SERVICE ALERT: test.testing.local;Service Tomcat;OK;SOFT;6;TOMCAT OK
and currently that is not happening.
My services.cfg file content is given below
define service {
host_name test.testing.local
service_description Service Tomcat
check_command check_nrpe!check_service_tomcat
max_check_attempts 10
check_interval 1
retry_interval 1
active_checks_enabled 1
check_period 24x7
register 1
}
I am using Nagios 4.2.2 and CentOS 7.
I think what you are after is from the Nagios 4 Core docs here
check_interval: This directive is used to define the number of "time units" between regularly scheduled checks of the host. Unless you've changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.
retry_interval: This directive is used to define the number of "time
units" to wait before scheduling a re-check of the hosts. Hosts are
rescheduled at the retry interval when they have changed to a non-UP
state. Once the host has been retried max_check_attempts times without
a change in its status, it will revert to being scheduled at its
"normal" rate as defined by the check_interval value. Unless you've
changed the interval_length directive from the default value of 60,
this number will mean minutes. More information on this value can be
found in the check scheduling documentation.
If you were to set your check_interval to 1 minute (which is pretty frequent, the default as you can see is 60) you will retry every 1 minute 10 times (max_check_attempts in your config) without a change in status then it will give you an OK/UP state.