logo sykohpath.com

				where code goes to die

Set up a cron job

A cron job is a way to "automatically" run a script at a specific interval.  It's not too difficult to setup.

1) From terminal, edit the cron table:
crontab -e
2) That starts a VI session to enter lines.  Press i to start edit mode.
3) Add the job in the following format:
<minute>     <hour>     <month_day>     <month>     <week_day>     [removed]
So, an example to run a script every weekday (1-5) at midnight (0:0), every month (*):
0    0    *    *    1-5    /home/sykohpath/scripts/script.sh
4) When finished, press ESC, then : to bring up the prompt, and finally save and quit by typing x

Note: An email is sent to the useracount that executes the cron job, so it's a great way to get confirmation that the script ran automatically or not.  However, this can get annoying, so to disable it, add the following at the end of the cron job line that emails are not desired:
/dev/null 2>&1
(write output to null).

Reference: Crontab Quick Reference

linux, reference,



SSH Tunnel

Mainly for my reference since I can't seem to remember exactly:

ssh -D <port> <user>@<host>

Configure software to use SOCKS proxy:

localhost:<port> OR using <port>

linux, reference,



Custom BURG Background

Might as well throw this one in the mix.

Ok, no walkthrough for installing BURG, so tough...plenty out there.  HOWEVER, I wanted a custom background for the "radiance" theme I was using.  Sure, can customize a new theme entirely, but the look and feel of radiance is good enough...just needs a new background.

1) Terminal, need to "explore" to the location of the current background...
gksu nautilus

2) Go to
and open up the theme you want to change the background for.  In my case, this is "radiance".

3) Open up background.png, and mess around with that.  Ideally, you want the same "details" as the existing image so as not to have a weird, distorted image:

4) That's it!  Reboot and be surprised at how easy that was.

burg, linux, mint,



Auto-install Important Updates

I'm one of those people that like to have everything updated every day.  So, every day when I log-in, I run Update Manager.  Well, that's freaking annoying, why can't it run automatically?  CRON JOB TIME.

First, get this through Software Manager, or whatever you use.  The package is called:

Next, open terminal...well, open this biglong filename:
Code Sample:
  1. sudo gedit /etc/apt/apt.conf.d/02periodic

And cram all this stuff inside:
Code Sample:
  1. # Enable the update script (0 = disable)
  2. APT::Periodic::Enable "1";
  3. # Get package lists every X days - apt-get update
  4. APT::Periodic::Update-Package-Lists "1";
  5. # Get upgrades every X days - apt-get upgrade --download-only
  6. APT::Periodic::Download-Upgradeable-Packages "0";
  7. # Clean every X days - apt-get autoclean
  8. APT::Periodic::AutocleanInterval "0";
  9. # Allow unattended script to run
  10. # Requires the package “unattended-upgrades” and will write
  11. # a log in /var/log/unattended-upgrades
  12. APT::Periodic::Unattended-Upgrade "1";

Change how often you want to update...heck, just read the comments, it's pretty self-explanatory.

Next, confirm the settings for what you actually want to download.  
Code Sample:
  1. sudo gedit /etc/apt/apt.conf.d/50unattended-upgrades

My default didn't grab "stable", so I had to add it at the top:
Code Sample:
  1. // Automatically upgrade packages from these (origin, archive) pairs
  2. Unattended-Upgrade::Allowed-Origins {
  3. "${distro_id} stable";
  4. "${distro_id} ${distro_codename}-security";
  5. // "${distro_id} ${distro_codename}-updates";
  6. // "${distro_id} ${distro_codename}-proposed";
  7. // "${distro_id} ${distro_codename}-backports";
  8. };
  9. // List of packages to not update
  10. Unattended-Upgrade::Package-Blacklist {
  11. // "vim";
  12. // "libc6";
  13. // "libc6-dev";
  14. // "libc6-i686";
  15. };
  16. // This option allows you to control if on a unclean dpkg exit
  17. // unattended-upgrades will automatically run
  18. //   dpkg --force-confold --configure -a
  19. // The default is true, to ensure updates keep getting installed
  20. //Unattended-Upgrade::AutoFixInterruptedDpkg "false";
  21. // Split the upgrade into the smallest possible chunks so that
  22. // they can be interrupted with SIGUSR1. This makes the upgrade
  23. // a bit slower but it has the benefit that shutdown while a upgrade
  24. // is running is possible (with a small delay)
  25. //Unattended-Upgrades::MinimalSteps "true";
  26. // Send email to this address for problems or packages upgrades
  27. // If empty or unset then no email is sent, make sure that you
  28. // have a working mail setup on your system. The package 'mailx'
  29. // must be installed or anything that provides /usr/bin/mail.
  30. //Unattended-Upgrade::Mail "root@localhost";
  31. // Set this value to "true" to get emails only on errors. Default
  32. // is to always send a mail if Unattended-Upgrade::Mail is set
  33. //Unattended-Upgrade::MailOnlyOnError "true";
  34. // Do automatic removal of new unused dependencies after the upgrade
  35. // (equivalent to apt-get autoremove)
  36. //Unattended-Upgrade::Remove-Unused-Dependencies "false";
  37. // Automatically reboot *WITHOUT CONFIRMATION* if a
  38. // the file /var/run/reboot-required is found after the upgrade
  39. //Unattended-Upgrade::Automatic-Reboot "false";
  40. // Use apt bandwidth limit feature, this example limits the download
  41. // speed to 70kb/sec
  42. //Acquire::http::Dl-Limit "70";

Aaaaand you're all set.  So now I can simply log in and magically...not manually update every dang thing.

ubuntu, mint 12, linux, auto install, updates,



Linux Mint 12 Auto Mount Drive

Here's how to automount a drive:

1) First, open up terminal, and determine what type of drive format it is:
Code Sample:
  1. sudo blkid

With a second hard drive, it'll most likely be /dev/sdb1 or something around there.  If you've labeled your drive, chances are it'll say LABEL="your label".  Note the TYPE="xxxx", which will determine which of the following you'll use.  In my example for my secondary hard drive:

/dev/sdb1: LABEL="Storage" UUID="92DEADA8DEAD8557" TYPE="ntfs"

2) Now you'll make your directory for your new mount.  I like to keep the name of the folder the same as the drive label, but you can name it whatever you want.

Code Sample:
  1. sudo mkdir /media/Storage

3) Man this is so hard.  Now open up your fstab...

Code Sample:
  1. sudo gedit /etc/fstab

4) And depending on your drive type, follow only the appropriate one:

*NOTE* It doesn't show up correctly here, but there is a tab where every space is.  This is important!  Copy-paste from here won't give you exactly what you need, so simply delete each space and TAB once.

/deb/drive     /media/location     type     defaults     0     0

Also, make sure you replace "/dev/sdxx" with your drive (such as "/dev/sdb1") and the "/media/xxxxx" with your same directory name you did above (such as "/media/Storage").

Code Sample:
  1. /dev/sdxx /media/xxxxx ntfs defaults,umask=007,gid=46 0 0

Code Sample:
  1. /dev/sdxx /media/xxxxx vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0

Code Sample:
  1. /dev/sdxx /media/xxxxx ext3 defaults,noatime 0 2

Note: If you ever remove/comment out this line in /etc/fstab, the drive will be stuck in "read-only" mode.

ubuntu, mint 12, linux, auto mount,