apcupsd under RHEL/CentOS

The following is a quick’n dirty HOWTO for installing apcupsd under Redhat Enterprise Linux / CentOS 4 as it is not really trivial.

  • untar the tarball
  • cd to the newly created directory apcupsd-x.y.z
  • call configure to build the appropriate Makefile for the platform
  • copy the tarball to whereever your _topdir resides, e.g. /home/user/rpm/SOURCES
  • copy the file Release\_Notes also to /home/user/rpm/SOURCES and create there a zipped tarball named Release_Notes-x.y.z-r.tar.gz (versions numbers must match those defined in apcupsd.spec)
  • call rpmbuild -ba –define “build\_rhel4 1” –define “build\_usb 1” apcupsd.spec
  • install it and adjust /etc/apcupsd.conf to your needs.

Important point: You must assure that after a system shutdown when mains power comes back, your computer starts automatically. In my case this has not happend. I had to tweak manually /etc/init.d/halt to not issue a “halt -p” (-p stands for power down). Its enough to comment out the line which extends the HALTARGS variable.

mirror cygwin for local installation – enhanced version of mkcygwget

If you plan to install cygwin on a couple of computers or on a host with limited internet access you might want to have a local mirror of the installation packages for setup.exe . There’s already a handy script called mkcygwegt which does the job for you. All you have to do is to provide a mirror URL. It downloads setup.ini then parses it and generates a file which consists of the apporpriate wget calls (cygwget).

However, I was not really contend with this script and improved a bit the way how cygwget is generated: Continue reading “mirror cygwin for local installation – enhanced version of mkcygwget”

How to shutdown Windows XP via script

Basically there are two ways of shutting down Windows via Scripts: With admin-rights or without.

The tools that work with admin rights are:

  • shutdown.exe which comes with Windows XP Pro etc.
  • psshutdown.exe which comes with pstools (sysinternals.com)
  • the WMI method

Tools that work without admin rights: AutoIt-Script with single call “shutdown(13)”.

Granting access to non admin users to shutdown

In the  administrative tools – local security settings – local policies – user rights assignment:  Click “Force shutdown from a remote system” at the right. Click “Add User or Group”.  Enter the name INTERACTIVE and click “Check names”. This gives the right only to an interactive user. Its not possible to shutdown the computer over the network with that setting.