How to schedule your tasks in linux
In this technical world, people are not getting the right time to do their work because of busy schedule.
So, they need some concepts to automatically do their process at some particular time. For an example, if you want to send birthday wish to your friend at mid night, unfortunately you are feeling too sleepy you can schedule it. That is you can set some timer schedule which will automatically send the message at the time you need.
Like that, you may face some problem while downloading. You should wait until the download gets finished. After that only you can copy or send to some other people.
In Linux, you can do it with shell script
Using this you can schedule your process based on the timings.
Before going into this, you should atleast have some basic knowledge about scripting, but it is easier to learn.
Step1:
First, you just open any file with extention .sh
That is shell script file.
Ex,
vi autoexe.sh
Step2: then type the following.
`sleep 10`
`rm autoexe.sh`
echo "File has been removed after 10 seconds"
-> you can set the time, that is after how many seconds you wish to execute the command you mentioned in the second line.
-> sleep command will make the execution of the second line upto some seconds that mentioned after sleep command.
Step3:
Finally, just run the script using the following syntax.
Syntax.
sh file_name.sh
Ex,
sh autoexe.sh
That's all, you have scheduled you task after 10 seconds.
So, they need some concepts to automatically do their process at some particular time. For an example, if you want to send birthday wish to your friend at mid night, unfortunately you are feeling too sleepy you can schedule it. That is you can set some timer schedule which will automatically send the message at the time you need.
Like that, you may face some problem while downloading. You should wait until the download gets finished. After that only you can copy or send to some other people.
In Linux, you can do it with shell script
Using this you can schedule your process based on the timings.
Before going into this, you should atleast have some basic knowledge about scripting, but it is easier to learn.
Step1:
First, you just open any file with extention .sh
That is shell script file.
Ex,
vi autoexe.sh
Step2: then type the following.
`sleep 10`
`rm autoexe.sh`
echo "File has been removed after 10 seconds"
-> you can set the time, that is after how many seconds you wish to execute the command you mentioned in the second line.
-> sleep command will make the execution of the second line upto some seconds that mentioned after sleep command.
Step3:
Finally, just run the script using the following syntax.
Syntax.
sh file_name.sh
Ex,
sh autoexe.sh
That's all, you have scheduled you task after 10 seconds.



Comments