Script that opens all Applications, that you needed for the work.
I have written this script a few months back, that runs the application that I use daily for work, If I login into the system at a specific time interval :)
In this logic we check what is the day of the week is, If it is Saturday or Sunday exit the script. The command used here is – cut – remove sections from each line of files – d – use DELIM instead of TAB for the field delimiter – f select only these fields; also print any line that contains no delimiter character, unless the -s option is specified*
day=$(date | cut -d " " -f1)
not_days=(Sun Sat)
if [[ " ${not_days[@]} " =~ $day ]]
then
exit 1
fi
Here we're calculating the difference with the current time on the system, If the difference is less than one, we will specify the application we want to run, else exit.
dbtimestamp=1050
secondsDiff=$(( `date '+%H%M'` - $dbtimestamp ))
echo $secondsDiff
So here is the full script
#!/bin/bash
day=$(date | cut -d " " -f1)
not_days=(Sun Sat)
if [[ " ${not_days[@]} " =~ $day ]]
then
exit 1
fi
dbtimestamp=1050
secondsDiff=$(( `date '+%H%M'` - $dbtimestamp ))
if [ $secondsDiff -lt 1 ]
then
hexchat &
firefox &
safeeyes &
# other application you want to open
else
exit 0
fi ;
There are some improvements which I will do in the scripts in future – Time delta logic for running the application needs to be improved. – Flag to override the all check condition and run the applications
Cheers!