481 reputation
26
bio website starshine.org/jimd
location
age
visits member for 4 years, 4 months
seen Oct 15 at 9:54

Feb
20
awarded  Nice Answer
Jan
5
revised How to restart the Python script automatically if it is killed or dies
Added link to PEP 3143 ... proposal for Daemon functionality in the Python Standard Libraries
Jan
5
comment How to restart the Python script automatically if it is killed or dies
If you use a cron job then you'll want to either implement or find some code for robust PID file handling. You want to have your service/script/daemon create a PID file (conventionally located under /var/run) and have its start-up code check if the file contents are stale (left by a killed process). This sort of code is surprisingly difficult to write free of races and corner cases. stackoverflow.com/questions/788411/…
Jan
5
answered How to restart the Python script automatically if it is killed or dies
Jan
4
comment On executable files in Linux
UNIX scans the first block of the file for certain patterns ("magic numbers") which affect how the file is executed. This varies. #! is interpreted by kernel as a magic number. Linux also supports old COFF/a.out and ELF binary formats, for example. Failing all that (plain text with not #! "comment" ... the shell may attempt to process the text as a script (as csh does, for example). Also Linux supports registration of magic numbers for things like Java .class files with custom interpreters) --- though this is rather obscure (Google: binfmt_misc).
Jan
4
comment On executable files in Linux
Actually there are some other more subtle differences. In MS-DOS and MS Windows batch files are limited to ending in the .BAT extension (and I they added .CMD for NT and later). The 4DOS alternative to COMMAND.COM (and its ilk, including the Norton Utilities derivative) also accepted the .BTM extension. Other than that one could create associations between extensions and executables (including script interpreters) ... but this still isn't much like simply having an executable bit in thee file's mode.
Jan
4
comment On executable files in Linux
The original MS-DOS filesystems only support a handful of "attributes" -- System, Hidden, Volume Label(!), Archive, and Read-only (if I remember correctly). I think there may have been some "reserved bits" which were never used. (Yes, they had a bit on every directory on the system to indicate that this entry was NOT the volume label; it really was that stupid). System was sort of like "hidden+read-only" but different. It was an ill-conceived mess. The "volume bit" was used later, in VFAT, to implement long name support.
Nov
5
awarded  Yearling
Nov
10
awarded  Nice Answer
Aug
22
awarded  Yearling
Jun
5
answered Why is Linux commonly used as operating system for supercomputers?
May
6
comment What's a convenient way of checking what's being added to a log file in realtime?
tail -f | grep ... | while read line; do ...; done is an extremely common scripting idiom among sysadmins. (Yes variants of of it using popen() styled subprocesses count as using the same idiom). It's used to selectively process logged events in near real-time (for example to send alerts or initiated automated remediation scripts).
Jan
20
comment testing services/open ports with telnet?
You cannot use telnet over "any TCP port." You can use it over any TCP connectin where the other side accepts text in its protocol handling. (However it is true that many traditional protocols are text based and thus allow the use of telnet for debugging and similar purposes).
Jan
18
comment Is it possible to stop a shutdown command?
@Ken: shutdown -c and [Ctrl]+[c] are entirely different. shutdown -c is a command which cancels a previously scheduled shutdown (even "now" is scheduled in this sense --- but whether the cancellation will prevent the reboot is a bit of a race in that case). [Ctrl]+[c] will cause you terminal to generate a SIGINT (interrupt signal) to whichever process was currently attached to it. This might work on a running shutdown command but that's rather incidental to your question.
Jan
17
comment How can I pause/resume rsync
Also note that Ctrl-Z to suspend a process is likely, after some time, to result in the timeout of any TCP network connections which were established by that program. Thus leaving an rsync suspended for more than a few minutes will very likely cause it to quit abruptly with an error message when you put it back in the foreground and it finds that its opened sockets are returning errors from reads and writes.
Jan
17
revised Resources to learn linux architecture in detail?
Fixed a couple of typos and clarified final paragraph.
Jan
17
answered Resources to learn linux architecture in detail?
Jan
17
awarded  Supporter
Sep
14
comment Scheduling commands by system inactivity
Keep in mind that uptime reports load averages for three different intervals (last minute, last five minutes and last fifteen minutes). In general load average is only the average number of items in the run queue during that time interval. On some systems (Linux in particular) processes in "D" state are counted as runnable. So a system with processes waiting on a slow (or missing) NFS server can appear to have a large load average that has nothing to do with real load on the system.
Sep
13
awarded  Editor