April 27, 2010 at 7:06 am · Filed under Programming
Here is a great little tut on getting started in Bash. I’d recommend it to anyone trying to hack their way into a shell script.
Here is a quick script for sending an email:
#!/bin/bash
# Subject of email
SUBJECT="Test email with attachment from a bash script"
# Where to send it
TO_ADDRESS="your@email.com"
# Where the attachment is
ATTACHMENT_FILE="/tmp/attachment.txt"
# For fun, let's put something into the attachment
echo "This goes into the file." > $ATTACHMENT_FILE
echo "This appends to the file." >> $ATTACHMENT_FILE
# send the message
/bin/mail -s "$SUBJECT" "$TO_ADDRESS" < $ATTACHMENT_FILE |
August 3, 2008 at 1:24 pm · Filed under Programming
Had a service in CentOS 4 server that went down every time the box rebooted. Got tired of starting it manually so I had to go find the command to start it automagically.
Surprisingly, it has nothing to do with “service”, which is how you start/stop it manually. It has the very unintuitive command “chkconfig” to make it start on boot. What a choice: chckconfig!
Oh well, here it is:
chkconfig --add httpd
chkconfig httpd on |
November 26, 2007 at 3:30 am · Filed under Programming
find / -type f \( -perm -2 -o -perm -20 \) -exec ls -lg {} \; |
May 4, 2007 at 6:55 pm · Filed under Programming
/usr/bin/ssh -v -a -L 2401:localhost:2401 cvsnobody@ns2.cyterm.com |