Results 1 to 3 of 3
To create a daemon, you need to execute these 2 lines (among others):
Code:
init log
umask 0
What do each of these do?
I didn't find anything on the ...
- 01-07-2011 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 15
[BASH] Daemon template
To create a daemon, you need to execute these 2 lines (among others):
What do each of these do?Code:init log umask 0
I didn't find anything on the 1st line.
(The queries returned mostly "the log of the init (process)".)
Google cast some light on the 2nd line:In what case you wouldn't have the same full access?By setting the umask to 0, we will have full access to the files generated by the daemon. Even if you aren't planning on using any files, it is a good idea to set the umask here anyway, just in case you will be accessing files on the filesystem.
Last edited by courteous; 01-07-2011 at 06:23 PM.
- 01-07-2011 #2
I don't know about the "init log" line. But specifically what umask does is it controls the default permissions of files you create:
It's usually worth at least masking out the write bits for "other" (the last "2") and it's often worth masking out the write bit for the "group" (the second-to-last "2").Code:$ umask 0 $ gcc -o test test.c $ ls -l test -rwxrwxrwx 1 tetsujin tetsujin 6824 Jan 7 18:35 test $ # We don't normally want that. Any other user on the system can modify that file! $ rm test; umask 022; gcc -o test test.c $ ls -l test -rwxr-xr-x 1 tetsujin tetsujin 6824 Jan 7 18:37 test $ # Note that the write bit, which has value "2" is masked out of the permissions for "group" and "other"
Really, I can't think of why you'd want all users on the system to be able to write to your log file...
- 01-08-2011 #3Just Joined!
- Join Date
- Dec 2010
- Posts
- 15


Reply With Quote
