So, you willing to learn - some starting points...
The script will run as long as the pc is on.
Ok, this can be achieved with a loop what will run forever, like the next one:
while : do some_commands done
When the mp3 ends it must continue.
As above - if the some_commands contains the command to playing the file - the script will wait until the command finishes and will start over - again, and again, and again... forever...
The file changes all the time. New lines go in and other line are removed.
Don't need to care until it is a file...
... if a line matches the current date and time it will play the mp3 via mplayer/mpg123 at the correct time.
So, first you need get the date in the needed format. This can be achieved with the date command. (man date)
The needed format is %d%m%Y%H%M, so the
date +"%d%m%Y%H%M"
will print the current date/time in the wanted format
assing the result of the command to some variable in bash can be done with the
variable=$(command argumens)
so,
datestr=(date +"%d%m%Y%H%M") echo $datestr
will assing the current date/time to variable datestr.
... read through the file and if a line matches the current date and time ...
The Read-thru and match can be done with the grep command (man grep), so, you need use
grep "what_want_to_match" filename_where_want_to_match.txt
The grep exits with a status codes
- 0 - found a match
- 1 - match not found
- 2 - the file doesn't exists
The exist status of previous command is stored in the special variable $?. You can test the exit status, for example with the bash's case construction, like:
some_command case $? in 2) echo "The some_command exited with status 2" ; exit 2 ;; 1) echo "with status 1" ; do_something_else ;; 0) echo "normal exit" ;; esac
Now, you have enough informations to try write the script yourself, and if you meet some specific error - ask again... ;)