Posts from the ‘FreeBSD’ Category

Small shell script to check webserver availability

With the following shell script we will:

1. By every 5 minutes will be checked if the w3m is getting the “200 OK” output.

2. If yes, then the script stops.

3. If no, then the command mail sends an email message warning the administrator about this issue.

4. The “/root/mailmsg.txt” file is where your customized warning message will be. You can certainly place it anywhere else if you wish so.

So, where’s the beef? Here it is, add the following code to your crontab (or write a separate file and point it in your crontab):

 */5 * * * * w3m -dump_head my-hi.com | grep -q '200 OK' || echo 'Your website is down' | mail -s 'Your website is down' admin@domainxyz.com < /root/mailmsg.txt 

 

Advertisements

FreeBSD ports – make arguments

Here I list some arguments very useful for the FreeBSD ports.

  • config – Opens up the package’s configuration dialog to turn options on or off.
  • config-recursive – Same as “config,” but also shows dialogs for package’s dependencies.
  • rmconfig – Removes user-specified configuration settings.
  • rmconfig-recursive – Same as “rmconfig” but removes settings for dependencies as well.
  • clean – Removes compiled work files, but not the installed files or downloaded source code.
  • distclean – Removes downloaded source code and work files for the package and its dependencies.
  • install – Installs the package once compiled.
  • deinstall – Removes a package from the system, akin to “pkg_delete.”
  • deinstall-all – Same as “deinstall,” but removes the package’s dependencies too.
  • reinstall – Used to upgrade a Port that first had to be removed with “deinstall”.

Usage example:

# cd /usr/ports/net-p2p/transmission

# make config-recursive

# make install distclean

 

Source: http://blog.zolp.us/2010/09/its-free-free-free-freebsd-part-2.html