One Lumen
let’s shed some light
  • Home
  • About
    • Conditions
    • Copyright Notice
    • Disclaimer
    • Privacy Policy
  • Renewable Energy

Oct 28 2014

Rotate Apache log files they easy way

Here is how I configured access.log, ssl_request.log and error.log to rotate at midnight every day.

Put this below script in a file named rotateall.cmd and schedule a task to run at 12:00am every day.

Change the paths and service name to sute the setup.

@echo off

REM
REM Apache Log Rotation Script
REM

REM The location of the squid log files
SET APACHE_LOG_PATH=C:\Apache22\logs

REM Stop Apache service
net stop Apache2.2

REM date format
REM FOR /F "tokens=1-4 delims=/ " %%j in ('date /t') do set YYYYMMDD=%%l-%%k-%%j

REM date format
FOR /F "tokens=1-4 delims=/, " %%i in ('date /t') do set YYYYMMDD=%%l-%%k-%%j

REM Rename the log file
ren "%APACHE_LOG_PATH%\access.log" "access-%YYYYMMDD%.log"
ren "%APACHE_LOG_PATH%\error.log" "error-%YYYYMMDD%.log"
ren "%APACHE_LOG_PATH%\ssl_request.log" "ssl_request-%YYYYMMDD%.log"

REM Restart the squid service
net start Apache2.2

By sysadmin • IT, Scripting • 0

Jan 16 2014

Reboot Raspberry Pi every Sunday

I needed to restart my Raspberry Pi every Sunday at 11:56 pm, here is a quick howto.

Here is a link to a cron job script calculator if you don’t want to learn cron.

http://www.csgnetwork.com/crongen.html

Below are the steps I took

1. Edit
pi@rspi01:~$ crontab -e

2. Add the entry
56 23 * * 0 sudo /sbin/shutdown now -r

3. Exit and save
crtl+x
y
enter

3. Restart cron
pi@rspi01:~$ sudo /etc/init.d/cron restart

Restarting periodic command scheduler: cronStopping periodic command scheduler: cron.
Starting periodic command scheduler: cron.

By sysadmin • Raspberry PI • 0

Jan 8 2014

Schedule daily restart of a Cisco router

Here is a quick post to reload a Cisco router at an interval, every day at 4:00 am.

router#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.
routerl(config)#kron policy-list reload-router
routerl(config-kron-policy)#cli reload
router(config-kron-policy)#exit
router(config)#kron occurrence reload-router at 4:00 recurring
router(config-kron-occurrence)#policy-list reload-router
router(config-kron-occurrence)#exit
router(config)#exit
router#wr

By sysadmin • Cisco • 0 • Tags: cisco

Nov 12 2013

add static route under linux

I needed to add a static route on our Asterisk CentOS Linux box to force traffic out the second router to our voice service provider.

Here are three ways;

1.  Note; does not survive a re-boot

root@pbx~]# ip route add 192.168.100.0/24 via 192.168.5.253

2.  Add the route to rc.local

root@pbx ~]# nano /etc/rc.local

3.  Add it to route-eth0, I think this the best way but you will need to restart the the network with /etc/init.d/network restart

root@pbx ~]#nano /etc/sysconfig/network-scripts/route-eth0

reference;

http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-networkscripts-static-routes.html

http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-networkscripts-static-routes.html

By sysadmin • Asterisk, Linux • 0

Oct 23 2013

Static entry in use, cannot remove

Have you ever tried to remove a NAT entry on a Cisco router only to get the error message Static entry in use, cannot remove?

Here is a way to get the job done

Error message

gw01#conf t
Enter configuration commands, one per line. End with CNTL/Z.
gw01(config)#no ip nat inside source static udp 192.168.41.10 5060 interface Dialer0 5060
%Static entry in use, cannot remove
gw01(config)#exit

Incase you mess it up schedule the reload command in ten minutes and the router will boot up from the startup-config

gw01#conf t
Enter configuration commands, one per line. End with CNTL/Z.
gw01#reload in 10
Reload scheduled for 07:06:18 UTC Fri Jan 4 2013 (in 10 minutes) by admin on vty0 (192.168.5.69)
Reload reason: Reload Command
Proceed with reload? [confirm]

Change the command to suite your interfaces I am using BVI1 and dialer0

gw01#conf t
Enter configuration commands, one per line. End with CNTL/Z.
gw01(config)#interface BVI1
gw01(config-if)#no ip nat inside
gw01(config-if)#exit
gw01(config)#interface Dialer0
gw01(config-if)# no ip nat outside
gw01(config-if)# exit
gw01(config)#do clear ip nat translation forced
gw01(config)#no ip nat inside source static udp 192.168.41.10 5060 interface Dialer0 5060
gw01(config)#interface BVI1
gw01(config-if)# ip nat inside
gw01(config-if)# exit
gw01(config)#interface Dialer0
gw01(config-if)# ip nat outside
gw01(config-if)# exit
gw01(config)#exit

Save the running-config to the startup-config

gw01#wr
Building configuration…
[OK]
gw01#

That’s it.

By sysadmin • Cisco • 0

Sep 9 2013

Can’t download .mobileconfig from webserver

I created a number of .mobileconfig files to deploy settings to our corporate iPhones and iPads. I placed them in a directory on an ISS internal webserver but when I tried to access them from a iPad or iPhone I received “The page cannot be found” and “HTTP error 404 – File or directory not found”.

Solution – configure MIME Types in IIS

In Internet Information Services Manager right click on the properties of the directory where your .mobileconfig files are.

Select the HTTP Headers tab and click on MIME Types then New.  In MIME Type dialog box enter the following

Extension: .mobileconfig

MIME type: application/x-apple-aspen-config

MIMExapple

By sysadmin • iPad • 0

1 2 3 4 5

Ads

Recent Comments

  • Wendy Sutton on Olympus DSS Player Pro won’t open – Windows 7
  • How To Fix Olympus Dss Player Error in Windows on Olympus DSS Player Pro won’t open – Windows 7
  • Joanne O'Brien on Olympus DSS Player Pro won’t open – Windows 7
  • Melanie Bergeron on Olympus DSS Player Pro won’t open – Windows 7
  • Philippa on Olympus DSS Player Pro won’t open – Windows 7

Ads

Categories

  • Asterisk
  • Cisco
  • iPad
  • IT
  • Linux
  • Outlook
  • Raspberry PI
  • Scripting
  • Solar
  • Squid
  • VMWare

↑

© 2012 onelumen.com |
Privacy Policy | Conditions of Use | Disclaimer