Short script to make screenshots and save them in predefined directory.
-
Write a
bash
script. -
The script should take a screenshot.
-
The screenshot’s name should contain date and time of taking.
-
All the screenshots should be saved in a predefined directory.
-
The directory’s name should contain date without time when all screenshots inside was taken. Basically for each day new directory should be created with appropriate date.
About cron.
To add new task to cron
use command crontab -e
and edit the file.
Caution
|
In cron days are count from 0 to 6 where 0 is Sunday and 6 is Saturday.
|
To fulfil specification it should look similar to code below:
*/15 * * * * export DISPLAY=:0 && $HOME/DIR_OF_YOUR_SCRIPT/screenshot.sh
Where DIR_OF_YOUR_SCRIPT
is actual directory of your script.
To test your cron
setup you can use cron guru.
Warning
|
Remember to give your script the access permissions to file system objects (files and directories).
For example use command chmod +x YOUR_SCRIP.sh
where YOUR_SCRIP is actual name of script.
|