Use a local date in option - rundeck

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.

Related

Setup cronjobs to different time zones in same 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 .

Bitbucket Pipeline schedule trigger

I can't see anyone talking about what I'm looking to do. I'm currently running a pipeline on a branch merge within the bitbucket area.
branches:
staging:
- step:
name: Clone
script:
- echo "Clone all the things!"
What I want to do is when a branch gets merged into master, trigger an event that will enable the schedule to run for the next day.
If there are no changes I don't want anything to run, however, if there are I want the schedule to kick in and work.
I've read through the Pipeline triggers:
https://support.atlassian.com/bitbucket-cloud/docs/pipeline-triggers/
But I can't see anywhere that would allow me to do it. Has anyone done this sort of thing? Is it possible, or am I limited by bitbucket itself?
Never done this, but there's an API for creating schedules. I think you would need to determine the date and specify the single cron task, e.g. March 30, 2022 at midnight:
0 0 30 3 * 2022
However year is an extension, not a standard CRON field; "at" is an alternative that may be accessible (but also not standard). It all depends on what Bitbucket allows for CRON schedule, so I think this is not a conclusive answer (still needs info on how to setup the schedule).
Here is the docs
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines_config/schedules/

Rundeck - Get in the script the username who executed the job

I would like to know if there is a way to get the username who executed the job and use it in the job which has been executed ?
If my question isn't clear, here is an example :
An user 'bobby' connects to rundeck and execute the job 'lets_go_to_the_moon'
In the job 'lets_go_to_the_moon' I want to get 'bobby' in a variable and use it to store this information in a database for example.
Ps : I know that this information can be retrieve in the database dedicated to rundeck, but is there a native variable dedicated to get this kind of information ? And if yes, how ?
Thank you guys,
Happy day !
You can use job.username context variable.
Command step format: ${job.username}
Inline-script format: #job.username#
"External" script format: $RD_JOB_USERNAME
If you are dispatching an "external" script to a remote node, take a look at this.
Here you can see all context variables available.

Wildfly - logging into one file

It seems my wildfly server produces separate log file for each day: like
server.log.2017-06-30 server.log.2017-07-06. Is it possible to make it logging into one (always same) file?
By default WildFly is configured to use a periodic-rotating-file-handler which rotates every day. If you don't want log rotation you can use a file-handler instead.
The following CLI commands will make the change to using a file-handler.
batch
/subsystem=logging/root-logger=ROOT:remove-handler(name=FILE)
/subsystem=logging/periodic-rotating-file-handler=FILE:remove
/subsystem=logging/file-handler=FILE:add(named-formatter=PATTERN, append=true, autoflush=true, file={relative-to=jboss.server.log.dir, path=server.log})
/subsystem=logging/root-logger=ROOT:add-handler(name=FILE)
run-batch
One attribute to note is the append attribute. I've set it to true so that you won't lose any log messages on a reboot or when this command is executed. If you're not concerned about losing log messages you could set it to false.

How to set a timezone for MySql Google Cloud SQL

Tried to create new costume flag from the developer console - doesn't work.
Tied from the command line: gcloud sql instances patch --database-flags time_zone
Doesn't work, get error: "invalidFlagName"
There is a database flag "default_time_zone" in developer console that you can use to specify timezone offset when you create a new instance or edit an existing instance.
See https://cloud.google.com/sql/docs/mysql-flags for detailed info.
The MySQL timezone tables are not populated so that flag is not supported via the --database-flags or web UI. If you are happy maintaining the tables yourself then ping us at cloud-sql#google.com with the setting you want and we'll manually set it.