OpenSolaris rsync install script

Posted by 4Aiur on 12/21/2010 in OpenSolaris |

OpenSolaris rsync install script #!/bin/bash # OpenSolaris rsync installer # Created by 4Aiur on 2010-12-21. # define function check_rsync_config () { if [ ! -d /opt/local/etc/rsync/ ]; then mkdir -p /opt/local/etc/rsync/ fi if [ ! -f /opt/local/etc/rsync/rsyncd.conf ]; then cat > /opt/local/etc/rsync/rsyncd.conf /opt/local/etc/rsync/rsyncd.secrets /var/svc/manifest/network/rsync.xml RSYNC daemon EOF fi } rotate_log () { logadm -w rsync […]

Tags: ,

Logrotate on OpenSolaris

Posted by 4Aiur on 12/21/2010 in OpenSolaris |

Logrotate on OpenSolaris On OpenSolaris, you use the logadm command, with the actual rotation being specified in /etc/logadm.conf logadm -v -w rsync -s 10m -C 10 \ -t ‘/var/log/rsync.log.%Y-%m’ \ -a ‘/usr/sbin/svcadm restart rsync’ \ /var/log/rsync.log Testing with logadm -p now rsync seems to work just fine.

Tags: ,

OpenSolaris net-snmp install script

Posted by 4Aiur on 12/16/2010 in OpenSolaris |

OpenSolaris net-snmp install script #!/bin/bash # OpenSolaris net-snmp installer # Created by 4Aiur on 2010-12-14. # define function check_netsnmp_config () { if [ ! -f /var/net-snmp/snmpd.local.conf ]; then cat > /var/net-snmp/snmpd.local.conf ############################################################################### # Process checks. # Make sure sshd is running proc sshd ############################################################################### # disk checks # disk PATH [MIN=DEFDISKMINIMUMSPACE] # Check the / […]

Tags: ,

使用python获取mp3中的歌词

Posted by 4Aiur on 12/09/2010 in Python |

使用python获取mp3中的歌词 安装依赖库eyeD3 $ sudo port install py26-eyed3 #!/usr/bin/env python # -*- coding: utf-8 -*- “”” dump_mp3_lyris.py Created by 4Aiur on 2010-12-09. “”” import os import eyeD3 def get_mp3_file(dir): mp3_files = [] files = os.listdir(dir) for file in files: if os.path.splitext(file)[1] == ‘.mp3’: mp3_files.append(os.path.join(dir,file)) return mp3_files def dump_lyrics(mp3_file): print(‘parse %s’ % (mp3_file)) lyrics_file = ‘%s.txt’ % […]

Tags:

使用python下载存放在Index中的资源

Posted by 4Aiur on 12/06/2010 in Python |

使用python下载存放在Index中的资源 Useing python threading download example. like this: wget -P result/ -nd -nH -r -l 1 -np -A pdf –http-user=book –http-password=cubook “http://www.4aiur.net/book/Programing/Python/” #!/usr/bin/env python # -*- coding: utf-8 -*- ”’ thread_download.py 下载网页中某种后缀名的文件 Created by 4Aiur on 2010-12-06. ”’ __version__ = “$Revision: 0.90 $” import threading import httplib import urlparse import base64 import re import os […]

Tags:

Python 三元表达式

Posted by 4Aiur on 12/06/2010 in Python |

Python 三元表达式 In [1]: x = 100 if True else 200 In [2]: x Out[2]: 100 In [3]: x = 100 if False else 200 In [4]: x Out[4]: 200

Tags:

Copyright © 2010-2024 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.