LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Corntab to run a script on last working day of the month (https://www.linuxquestions.org/questions/linux-newbie-8/corntab-to-run-a-script-on-last-working-day-of-the-month-4175664991/)

subir 11-27-2019 03:48 AM

Corntab to run a script on last working day of the month
 
how to make a Crontab to run a script on the last working day of the month.

TenTenths 11-27-2019 04:10 AM

Quote:

Originally Posted by subir (Post 6062272)
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.

subir 11-27-2019 10:13 PM

Why AT Command or crontab isn't running
 
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.

berndbausch 11-28-2019 01:10 AM

Something is wrong with your installation, I guess, but your description is not sufficient to help you.

Can you tell us the precise command that you enter, and the precise error message?

Also which distro you are using.

subir 12-03-2019 03:05 AM

Crontab to make directory in Desktop
 
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.

pan64 12-03-2019 03:54 AM

crontab has no any idea about your current location. Crontab has its own very special environment.

subir 12-03-2019 11:39 AM

Why crontab doesn't create file on Desktop
 
I tried command like
* * * * * mkdir new /home/subir/Desktop
But it create "new" directory in my home directory.
How to do that On desktop?

scasey 12-03-2019 11:56 AM

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?

jefro 12-03-2019 03:38 PM

As above, think of cron as a user trying to do a task.

subir 12-06-2019 10:33 PM

Crontab not working at specific time
 
My command is Cat > a.sh

mkdir abc

Crontab -e

56 09 * * * /home/subir/Jarvis/a.sh

Doesn't create abc directory at that given time

scasey 12-06-2019 11:06 PM

Quote:

Originally Posted by subir (Post 6065465)
My command is Cat > a.sh

mkdir abc

Crontab -e

56 09 * * * /home/subir/Jarvis/a.sh

Doesn't create abc directory at that given time

Basically a duplicate. The answer has been provide in your other threads.

Reported.

scasey 12-06-2019 11:12 PM

Opening a new thread with the same question is contrary to the LQ Rules.

What about the answers here do you not understand?

ehartman 12-06-2019 11:16 PM

Quote:

Originally Posted by scasey (Post 6064296)
Note that running mkdir from cron will only work the first time. mkdir will fail if the target directory already exists.

Using the -p option will fix that. See the man page.

scasey 12-06-2019 11:46 PM

Quote:

Originally Posted by ehartman (Post 6065471)
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)

michaelk 12-07-2019 04:25 AM

Yes but not necessarily in a clear way.

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.

mkdir /home/subir/Desktop/abc

Or whatever path you choose.

rtmistler 12-07-2019 03:24 PM

@subir,

There were five threads started by you regarding your efforts with cron to perform a simple test activity. These have been merged with your original thread on this topic.

Please refrain from opening multiple duplicate threads as you continue.


All times are GMT -5. The time now is 08:49 PM.