Posts Tagged ‘ linux

Niceness and Renice

So I was playing around with streaming media to my PS3 and came to a problem. My NAS running on Linux was running several items at the same time. Most noticeably is bit torrent and an internal site (Apache and MySQL). Due to this, streaming was stuttering and disconnecting randomly. It also produced an “dlna protocol error 2006″ on the PS3.

Digging around I found that the default nice level for the DLNA process was set to 19. Think of the nice level as the priority, with -20 the highest and 19 the lowest. Most definitely this will cause problems with so many processes running!

Started the top command and found all the DLNA processes after sorting the results and ran the renice command:

renice -5 -p pid

This re-prioritiezed the DLNA processes to be at a much higher priority. With that, the problem went away!

Once again, have fun!

Making things go automagically

Was working away at work today and required to have a PERL script to be loaded every Friday. To do this, I had to employ the help of crontab.

usage:  crontab [-u user] file
crontab [-u user] [ -e | -l | -r ]
(default operation is replace, per 1003.2)
-e      (edit user’s crontab)
-l      (list user’s crontab)
-r      (delete user’s crontab)
-i      (prompt before deleting user’s crontab)
-s      (selinux context)

  • A minute, expressed as a number from 0 through 59.
  • An hour, expressed as a number from 0 through 23.
  • A day of the month, expressed as a number from 1 through 31.
  • A month of the year, expressed as a number from 1 through 12.
  • A day of the week, expressed as a number from 0 through 6 (with 0 standing for Sunday).

Example of usage includes:

5 6 * * 1-5    command
10 8,14 * * 1-5  command

There will always be 5 specifications. A static number, static numbers with commas in between, a range between numbers with a dash or an asterisk to represent all possible values.