What's new

Schedule a task each last day of month

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Brouno

Occasional Visitor
It's a bit tricky, but you can do it

Use the following in /jffs/scripts/init-start script :

Code:
cru a THEIDYOUWANT "59 23 28-31 * * [[ \`date +\%d\` -gt \`date +\%d -D \%s -d \$(( \$(date +\%s) + 86400))\` ]] && THECOMMANDYOUWANT"

Replace :
THEIDYOUWANT, by a unique ID along your cru commands

THECOMMANDYOUWANT, by the command you want to execute each last day of month (usually a shell script)

Do not forget antislashs ( \ ) in script. Test without them directly on command line

It will execute "THECOMMANDYOUWANT" each last day of the month.
THECOMMANDYOUWANT is triggered at 23:59 when the value of the next day is lower than the current day, tested between 28 & 31 (for handling february)
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top