advert

Sunday, 2 September 2012

FreeBSD /usr/local/etc/anacrontab or startup command

ANACRON

Installation:

  • # pkg_add -r anacron
  • add anacron_enable="YES" to /etc/rc.conf

It wasn't easy to google an example for running Anacron so I decided to show mine.

I have got my shell script which create memory disk, mount it, create different directories for php and xcache entries.  Then change user/group rights for starting xcache. Although this is one-time job it will be running once a 30 days, first minute after system is started.


"/usr/local/etc/anacrontab"
PATH=/bin:/sbin:/usr/bin:/usr/sbin
# days make sure the command is executed at least every 'days' days
# delay delay in minutes, before a command starts
# id unique id of a command

# days delay id command
# 1 5 daily periodic daily
# 7 15 weekly periodic weekly
# 30 60 monthly periodic monthly
  30 1 onetime /root/start-xcache

You can make alteration for your need.

You can see what is ready to run here:
ll -h /var/spool/anacron/
For any problems check  /var/log/messages

References:
http://www.morpheushosting.sk/freebsd-usr-local-etc-anacrontab/

Sunday, 15 July 2012

Squid windowsupdate

Equium P300-16T repair.


Just for my record.

Successfully repaired notebook screen & back-light.
New system W7 installation + other original SW.
W7 had driver problem with SD card reader. It needs o2 driver.

Timescale:

- 1h screen repair.
- 1 day new system + other SW.
Most time due to slow M$ updating.
To avoid sluggish M$ updates in future I changed Squid proxy conf.

refresh_pattern -i .*\windowsupdate\.microsoft\.com/.*  43200 100% 100800 override-expire reload-into-ims ignore-no-cache

Any better idea for quicker or beeter SQUID updates? Please comment.

Tuesday, 10 July 2012

Squirrelmail Cannot redeclare hex2bin()

Introduction

This article describes how I resolved problem with Squirrelmail after upgrade PHP lang.


System:
FreeBSD 8.2-STABLE amd64
Apache/2.2.22
PHP 5.4.3
SquirrelMail version 1.4.22


Problem:

Squirrel mail just hanged and there were only blank page.

httpd-error.log:
PHP Fatal error:  Cannot redeclare hex2bin() in /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php on line 104


Resolve the problem:
I found that there is "simple" problem. We need just rename all occurrences of hex2bin with "convertHex2bin"

Prerequisites:
Rename all occurrences of hex2bin with "convertHex2bin"

Step 1

Find "hex2bin"

/usr/local/www/squirrelmail
FILE /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php
LINE 94 function hex2bin( $data ) {
FILE /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php
LINE 138     $txt = mf_keyED( hex2bin( $txt ) );
FILE /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php
LINE 94 function hex2bin( $data ) {
FILE /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php
LINE 138     $txt = mf_keyED( hex2bin( $txt ) );
FILE /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php
LINE 94 function hex2bin( $data ) {
FILE /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php
LINE 138     $txt = mf_keyED( hex2bin( $txt ) );

Step 2
Rename all with sed

sed -i '' "s/hex2bin/convertHex2bin/g" /usr/local/www/squirrelmail/plugins/mail_fetch/functions.php


References:
http://www.morpheushosting.sk/squirrelmail-cannot-redeclare-hex2bin/

Saturday, 31 March 2012

NAS Server - HELMER

NAS Server - HELMER

I do share the enthusiasm of people who love creativity and not by a user of a finished product. In this small article I share my experience with the wonder (PC) box HELMER from IKEA.



This hardware provide a backup web server.

What was the motivation?

Hard disks are fragile, and when strike a windows virus or another disaster then valuable data can end up in the digital heaven.

After several years of experience with a faulty drives, bored of copying and restoring Terabytes, I decided to do an upgrade of my central data storage (NAS).

The requirements for new data storage were the following :

    simple administration
    an easy extension (upgrade)
    data loss resistance
    data security (encryption)

I did use bit older hardware because performance was not my priority, but safety comes first.


What procedure I chose?

The first step was the cabinet. The inspiration was a Linux cluster project, set into HELMER IKEA cabinets.
It offers enough space for the future adding HDDs, and possibility to add another MiniATX server in same cabinet ...



First step was the PSU and the motherboard.

Later I revealed that my solution is a bit unfortunate because the system was heated more than I expected.
HDDs temperature ranged between 21 and 36 ° C.


Present discs location. Another variant will be the two fans in front.

Cables connected and successful launch of the system.

Helmer FreeBSD NAS Server

Conclusion.

System (FreeBSD 9.0) is running reliably couple of weeks.

About the system settings I will write next time.
Basic settings and how to setup the discs I have described here.
http://jadawin-freebsd.morpheushosting.sk/2010/07/64-bit-freebsd-81-rc2-generic-setup.html

Much useful information is the site of the FreeBSD project, but please be careful. Theory and practice are varying things.

Also you have any similar projects, or advice described on the NAS server?


Original version HERE

Friday, 10 February 2012

(httpd), uid 80: exited on signal 6

After upgrading PHP and PHP modules my apache 2.2 process have had few crashes. Messages are usually stored in /var/log/message.

Here is sample:
[root@www ~]# tail -f /var/log/messages
Feb  9 03:28:42 www kernel: pid 27208 (httpd), uid 80: exited on signal 6
Feb  9 09:25:18 www kernel: pid 45543 (httpd), uid 80: exited on signal 6
Feb  9 15:40:40 www kernel: pid 65751 (httpd), uid 80: exited on signal 6
Feb  9 21:22:38 www kernel: pid 76728 (httpd), uid 80: exited on signal 6
Feb 10 03:40:49 www kernel: pid 74647 (httpd), uid 80: exited on signal 6
Give it try: fixphpextorder.sh

Sunday, 22 January 2012

search engine protects your Privacy

Living free digital life without being tracing and collecting personal informations is possible.
Website www.startpage.com offering to you more than just search. There are another positives such as free proxy.
In my experience www.startpage.com is quick. I think that as advantage is their proxy server which is really quick.

In addition to increase your privacy you can choose some add-ons for Firefox. My favourites are http://www.ghostery.com/, http://noscript.net/, http://adblockplus.org and https://addons.mozilla.org/en-US/firefox/addon/betterprivacy/ which deletes supercookies!

For extra security can be add VPN or anonymous VPN such as btguard.com.

What are yours favorites?

Sunday, 1 January 2012

PHP Deprecated: Function split()

Apache logs were feeded with repating message:
PHP Deprecated:  Function split()

[Sun Jan 01 22:37:33 2012] [error] [client XX.194.XX.27] PHP Deprecated:  Function split() is deprecated in /web/public/.../wordpress/wp-content/themes/test/library/misc.php on line 19, referer: http://www....tk/wordpress/wp-admin/index.php

So upgraded PHP code:
 //     $words = split($sep, $str);
        $words = explode($sep, $str);
was the cure.