Corntab to run a script on last working day of the month
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to make a Crontab to run a script on the last working day of the month.
So what have you tried? You provide no useful information whatsoever as "last working day" can easily vary depending on how a company operates. A business that is open Saturday will have a different "last working day" from one that operates Monday -> Friday.
In any case, this kind of complex requirement should be handled inside your script rather than crontab.
Why AT Command or crontab isn't running in Linux? Whenever I tried to create its showing some "packages needed", display "sudo apt-get install <deb>"
So what to do to run AT or cronjob.
why cronjob is not working for the below command.
my current location is "desktop"
touch a.sh created a.sh file
vi a.sh
mkdir abcd/ a.sh content command a.sh
crontab -e
* * * * * /subir/home/Desktop/a.sh
cronatab install.
but not make any directory after 1 min.
See the man page: man mkdir for the correct syntax to create a directory.
Code:
SYNOPSIS
mkdir [OPTION]... DIRECTORY...
Note that running mkdir from cron will only work the first time. mkdir will fail if the target directory already exists.
Why do you want to run that command from cron? And why do you want to run it every minute?
Using the -p option will fix that. See the man page.
Point taken (ish), but with or without the -p option, re-executing the command from cron every minute is, IMO, pointless.
And, the -p option doesn't fix the fact that the OP is using incorrect syntax otherwise.
Nor does it fix the fact that the OP has asked the question in multiple threads three or four different ways but has provided no followup. They've asked the question, received an answer, and then asked the question again in a new thread. (sigh)
The command mkdir abc uses a relative path which is referenced to your current working directory. A absolute or full path is referenced to /. Since cron is not associated with the desktop or terminal window it does not have a current working directory. You should use the full desired path in your a.sh script.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.