peasthope@shaw.ca wrote: > What if the loop is backrgounded? That would still launch one every time you log in. You could potentially have many of them running. You would need to semaphore it so that only one incoming server runs at a time. Better to do it elsewhere rather than from your ~/.bashrc file. > while "1" do > if (inotifywait -e modify ~/control.sh) = 0 > then { chmod u+x ~/control.sh; ~/control.sh; } > ~/controlresult > fi > done & > > > I think you are saved because of the syntax error. > > I've changed while 1 to while "1". According to the dash manual, > a non-empty string evaluates to True. The syntax error I am talking about is the if statement. $ if (inotifywait -e modify ~/control.sh) = 0 bash: syntax error near unexpected token `=' But since that isn't really want you want to do, well it isn't what I recommend that you do, I wasn't inclined to help fix the syntax. Quoting 1 to "1" doesn't really change anything. Both are the same to the shell. It isn't like * where there is a huge difference between having a raw * that would expand as a metacharacter file glob and "*" which is a literal star character. The difference is that 1 isn't a meta character. > > 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. > > Accepted. But the last time I did any serious C programming > was 1987. If anyone gives link to an example, certainly it will > help. You can still use the shell. If I can find time today I will produce an example. But not very many hours in a day I am sorry to say. > Incidentally, the same issues must exist when someone develops > a Python script on a workstation and wants to interpret it on > another machine. Each time the python is revised and sent to > the other system, execute permission must be reinstated? Seems > a nuisance. I don't follow. Please explain. Are you talking about simply copying a python script to another machine and then setting a+x on it? Note that once the file exists once then the file permissions would be maintained. For the most typical ways of copying the script that is. But to be completely pedantically safe even if it is creating a new file with a restrictive umask then yes you would need to chmod a+x every time. Once it is scripted then it isn't a drudgery. > > The process will need to run as root. That is unfortunate. > > At least there could be an elapsed time limit on the > interpretation process. I am worried more about attacks against it than time limits. But we have already discussed the security aspects of it. > A better solution would be to implement J in the ETHO or A2 > single-user workstation and completely avoid jeopardizing a > Linux system. But I'm afraid that would occupy all my spare > time for a year or three. Meanwhile there are already too > many projects in progress. I can't tell if it has made it into Debian or not. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638725 Bob
Attachment:
signature.asc
Description: Digital signature