Don't touch that (non-existent) file!
AnthonyEnglish 270000RKFN Visits (3972)
You can create a file using the AIX touch command. The touch command is used to update a file's timestamp, but if the file doesn't exist, then the touch command creates it. That's an easy way of creating a lock file - the sort of file you use to alert the world that they can't log in because some process is running - or a trigger or flag file whose existence is a signal to some script or program to begin the next process.
The problem with creating an empty lock/flag/trigger file is that no one knows where it came from. You may love creating trigger files, but you don't want to leave a mess for someone else to clean up (or not clean up, because they were too afraid to break something). So you want to be neat and tidy.
"What a neat script!"
When you are creating a lock/trigger/flag file, you could use a very elaborate file name:
# touch the_
Or include the date stamp in the name:
# touch dayend.$(date +%Y%m%d)
But these approaches have their own difficulties. if you call it something like dayend.20120124 or login.flg then years after your script has been retired (yes, I have seen it happen) the empty files become sacred artifacts of a long lost civilisation: no one knows what they are for but they might be important, so you'd better not touch them. Well, you'd better NOT touch them! Instead, put something useful in them such as the date the files were created, the name of the script that created them, and the host name the script ran on:
# echo "$(date +%Y%m%d) This file was created by $0 on $(uname -n)" > myscript.flg
# cat myscript.flg
20120124 This file was created by /usr