Good Morning,
Since moving to imap the script newmail-maildir written by someone a long time ago no longer works.
I have procmail touch $HOME/.mail-semaphore with every mail that arrives.
Then have this script run every few minutes by crontab and print an alert to the screen.
It does not work because I don't know what I am doing. Hopefully you see the intent and can fix it.
It appears the time chack of the two files is not happening and the script dies.
The cat command works fine on the command line.
I tried comp.unix.shell, no help there.
Thanks,
Vic
#!/bin/sh
#!/bin/bash
# newmail-semaphore
# 20180305
### check if .mail-semaphore has a later timestamp than .mail-semaphore-flag
# if [[ "$HOME/.mail-semaphore-flag" -lt "$HOME/.mail-semaphore" ]]
if [[ "$HOME/.mail-semaphore-flag" -nt "$HOME/.mail-semaphore" ]]
then
### printed $HOME/.mail-semaphore to the screen.
cat $HOME/.mail-semaphore | /usr/local/bin/tellme.pl
touch -r $HOME/.mail-semaphore $HOME/.mail-semaphore-flag
fi
### from my .procmailrc
#
# SEMAPHORE=$HOME/.mail-semaphore
# :0c
# *
# | head -1 > $SEMAPHORE
#
#
Since moving to imap the script newmail-maildir written by someone a long time ago no longer works.
I have procmail touch $HOME/.mail-semaphore with every mail that arrives.
Then have this script run every few minutes by crontab and print an alert to the screen.
It does not work because I don't know what I am doing. Hopefully you see the intent and can fix it.
It appears the time chack of the two files is not happening and the script dies.
The cat command works fine on the command line.
I tried comp.unix.shell, no help there.
Thanks,
Vic
#!/bin/sh
#!/bin/bash
# newmail-semaphore
# 20180305
### check if .mail-semaphore has a later timestamp than .mail-semaphore-flag
# if [[ "$HOME/.mail-semaphore-flag" -lt "$HOME/.mail-semaphore" ]]
if [[ "$HOME/.mail-semaphore-flag" -nt "$HOME/.mail-semaphore" ]]
then
### printed $HOME/.mail-semaphore to the screen.
cat $HOME/.mail-semaphore | /usr/local/bin/tellme.pl
touch -r $HOME/.mail-semaphore $HOME/.mail-semaphore-flag
fi
### from my .procmailrc
#
# SEMAPHORE=$HOME/.mail-semaphore
# :0c
# *
# | head -1 > $SEMAPHORE
#
#