Useful Commands

From SME Server
Revision as of 09:01, 16 November 2007 by PicsOne (talk | contribs)
Jump to navigationJump to search

Created by: PicsOne (Normando Hall), added info: Kruhm

Apache Related Commands

  • Expand httpd.conf template:
expand-template /etc/httpd/conf/httpd.conf


  • Restart httpd:
/etc/init.d/httpd-e-smith restart


  • To leave Apache reads the distributed configuration file .htaccess per ibay:
db accounts setprop IBAYNAME AllowOverride All
signal-event ibay-modify IBAYNAME


  • Allow PHP URL File Open per ibay:

Make custom httpd directory if not exist

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

Create the template name 99allow_url_fopen and put the content

<Directory /home/e-smith/files/ibays/IBAYNAME/html>
php_admin_flag allow_url_fopen on
</Directory>

Save the file

Expand

expand-template /etc/httpd/conf/httpd.conf

Restart httpd.

/etc/init.d/httpd-e-smith restart

PHP Related Commands

  • Expand php.ini template:
expand-template /etc/php.ini


  • Configure PHP Basedir Restriction per ibay:
db accounts setprop IBAYNAME PHPBaseDir DIR1:DIR2:DIRn
signal-event ibay-modify IBAYNAME

Example

db accounts setprop Primary PHPBaseDir /home/e-smith/files/ibays/Primary:/tmp
signal-event ibay-modify Primary


  • Execution Time:
db configuration setprop php MaxExecutionTime ZZ
expand-template /etc/php.ini
/etc/init.d/httpd-e-smith restart

where ZZ is the time in seconds.


  • Memory Limit:
db configuration setprop php MemoryLimit XXM
expand-template /etc/php.ini
/etc/init.d/httpd-e-smith restart

where XX is the amount of memory in Mb.


  • Upload Max File Size:
db configuration setprop php UploadMaxFilesize WW
expand-template /etc/php.ini
/etc/init.d/httpd-e-smith restart

where WW is the file size in Mb.


  • Allow URL FOpen:

Not secure. Instead use per ibay or directory.

Squid Cache

Extracted from: http://forums.contribs.org/index.php?topic=38848.msg176737#msg176737

Flush and Restart

sv d /service/squid
echo "" > /var/spool/squid/swap.state
sv u /service/squid

& to check it's running

sv s /service/squid

Command-Line Quick Reference Guide

Below is a list of commands that I use all the time & tend to forget.

Generic Linux

COMMAND NAME		DESCRIPTION
man <commandname>       shows more info about a command
uname -r		kernel release version
/usr/sbin/smbd -V	samba version
/usr/sbin/httpd -v	apache version
mysql -v		mysql version
mv		        moves or renames a file
cp		        copies or backsup a file
rm		        removes or deletes a file
ps -ax|grep <process>	outputs processes running <process>
ps -AH		        report process status
top		        shows processes
top -i                  shows only active processes
iptraf		        shows network info
mc -d                   show midnight commander to navigate through system easily
cat /proc/mdstat	shows software raid
host -t mx aol.com	shows the mx records for aol.com
net groupmap list	shows samba mappings to nt groups
telinit 1		changes to single user mode
ifconfig		shows detailed info on ethernet ports
grep -r "casesensitivesearch" *		finds all documents containing the criteria in a dir
tail -f /var/log/<LOGFILE>		realtime viewing of your log file
hdparm -t /dev/mdx (where x is 0,1,2,etc)		shows software raid performance
mdadm --detail /dev/mdx (where x is 0,1,2,etc)		gives raid info

RPM's

rpm -qa		        shows all rpms installed
rpm -qa --last		shows all rpms installed & installation date
rpm -q 		        asks for rpm info
rpm -qi 		asks for detailed rpm info
rpm -ql <packagename>   lists all files in a package
rpm -qf <filename>      reports what package a file belongs to

YUM'ing

yum install <packagename>               installs packagename & any package it may need
yum remove <packagename>                removes packagename
yum list updates                        list updates to any installed package
yum list available                      list available packages in all repos not already installed
yum list available |grep <reponame>     list available packages -shows only from repo name
yum search <packagename>                lists all packages in all repos matching packagename
yum --enablerepo=<reponame> <command>   enables a repo not normally enabled

SME specific

signal-event post-upgrade		performs sme to go through templates
signal-event reboot                     reboots the server
/etc/e-smith/events/actions/navigation-conf		recreates right-hand menu
db config show		                shows the entire server configuration
db config setprop <serversetting>	changes your db service configuration
db accounts show <accountname>          shows the account detail