peasthope@shaw.ca wrote:
> Suppose ~/.bashrc ends with these 5 lines.
>
> exec while 1 do
> if (inotifywait -e modify ~/control.sh) = 0
> then { chmod u+x ~/control.sh; ~/control.sh; } > controlresult
> fi
> done
You have that in a loop forever, right? How will you log in? How
would you prevent this from hanging up in an infinite loop and
preventing you from logging into the account? I think you are saved
because of the syntax error. That isn't valid bash shell syntax.
Instead I think it would be better to create a daemon that runs as a
standalone process not associated with your login shell. Then after
developing and debugging and testing it I would copy
/etc/init.d/skeleton and modify it to start the daemon at boot time.
The process will need to run as root. That is unfortunate. Oh well.
> Whenever a fresh version of control.sh is put into ~ it is executed with
> results kept in controlresult.
>
> Any further tips before I shoot myself in the foot?
Bob
Attachment:
signature.asc
Description: Digital signature