nil.enroll(aetheric_username, quantum_class_id) (adric) wrote,
nil.enroll(aetheric_username, quantum_class_id)
adric

  • Music:

restart.rb

#!/usr/bin/ruby
## restart given service with eg /etc/init.d/$thing restart
## syntactic sugar, practice, Artistic License (C) 2008

## Debian and most use /etc/init.d/
@initscripts = '/etc/init.d/'

## Usage
def usage
 p 'restart.rb: Take one argument, a service name from /etc/init.d . '
 exit
end

## if number of args is not 1, show usage
if ARGV.length != 1
  usage
end

## check configuration
if ! File.directory?(@initscripts)
  p 'No such directory: ' + @initscripts
  usage
end

## get arg
@service = ARGV.pop

## if arg service is not in /etc/init.d , point that out and usage.
# if ![ -x '/etc/init.d/#{@service}']
if ! File.exist?(@initscripts + @service)
  p 'reboot.rb: ' + @initscripts + @service + ' not found.'
  usage
end

## And finally, cycle something
system(@initscripts + @service + ' restart')

iTunes: Played this haunting GITS track while I was posting, then a quick Origa track, and now back to Liz Phair for "Shitloads Of Money" from whitechocolatespaceegg. Out of 1315 songs, 3.3 days of music. And then Origa again. And now Liz Phair "May Queen", from Whip Smart. Now Origa - –Ø –ø–æ–¥–∞—Ä—é –¢–µ–±–µ –ú—É–∑—ã–∫—É which did not paste well at all, now did it.

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments