[mdlug] Run scrip on file arrival

Aaron Kulkis akulkis00 at gmail.com
Tue Mar 1 13:55:51 EST 2011


Stan Green wrote:
> On Tuesday 01 March 2011 09:57:04 am you wrote:
>> Stan Green wrote:
>>> I have two Debian systems; one user system and one server. The first
>>> system is used to create files. It includes a script that copies the
>>> video file to the other system for processing and storage. The copy is
>>> done over NFS. The hard part seems to be staring the processing on the
>>> file only after is is fully on the other box. I would rather not do a
>>> time based process due to issues with the file being still being copied.
>>> My thought was to create a small file and send it after I send the main
>>> file. This way the script could run every 5min and wait for the small
>>> file to arrive. It could then process all the video files and delete the
>>> small file. I have seen this type of setup used before and it seems to
>>> work. However is there a better way to accomplish this task?
>> scp  file  remotehost:/some/path/to/file
>> ssh remotehost /some/script/to/run
> 
> OK, so this is a side topic.
> 
> I would not what the user to have to interact with the script. They have a hard 
> enough time with the concept of logging off! (They are always trying to 
> shutdown!)


You might want to write a wrapper program in C which does
sudo to the desired username and runs the desired shellscript.
[This, of course, would be installed on the remote system,
not on the user's computer, and also edit /etc/sudoers on
the remote computer appropriately.]


Q:  Why is the user in question misbehaving by trying to shut down?
What's going on with management/supervision that they are not
taking any corrective action?

> With ssh, to keep the user from interacting with the script,  wouldn't I need to 
> put the user's password in the script?

No.  Big security hole. 

> I've seen many different ways to handle 
> this, but I have never been 100% happy with any of them. Is there a "best 
> practice" for putting passwords in scripts.

Either use sudo, or the user will have to BEHAVE LIKE 
A RESPONSIBLE ADULT WHO EARNS THEIR PAY, and type in
their own password.

If they can't handle this, then seriously, what other
basic work tasks are they also screwing up?



More information about the mdlug mailing list