mysytem.sh:
clear
echo "this is info provided by mysystem.sh. starts now:"
echo "Hello, $USER"
echo
echo "Todays dater is `date`, this is week `date+"%V"`."
echo
echo "these users are currently connected:"
w | cut -d " " -f 1 - | grep -v USER | sort -u
echo "This is `uname -s` runninig on a `uname -m` proccessor."
echo "This is uptime info:"
uptime
echo "That all folks!"
1.sh:
FILENAME="$1"
echo "Properties for $FILENAME:"
if [ -f $FILENAME ] ; then
echo "Size is $(ls -lh $FILENAME | awk { print $5 })"
echo "Type is $(file $FILENAME | cut -d":" -f2 -)"
echo "Inode number is $(ls -i $FILENAME | cut -d" " -f1 -)"
echo "$(df -h $FILENAME | grep -v Mounted | awk { print "On",$1",
which is mounted as the",$6,"partition."})"
else
echo "File does not exist."
fi
2.sh:copy files from /root/pics to web dir,
a new dir created every hour
PICDIR=/root/pics
WEBDIR=/var/www/html/pics
#while true; do
DATE=`date +%Y%m%d`
HOUR=`date +%H`
echo $HOUR
echo $DATE
mkdir $WEBDIR/"$DATE"
while [ $HOUR -le 23 ];do
DESTDIR=$WEBDIR/"$DATE"/"$HOUR"
mkdir "$DESTDIR"
cp $PICDIR/*.jpg "$DESTDIR"/
sleep 3600
HOUR=`date +%H`
done
done
|