Skip to content

Instantly share code, notes, and snippets.

@acid
Created January 11, 2010 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acid/274684 to your computer and use it in GitHub Desktop.
Save acid/274684 to your computer and use it in GitHub Desktop.
Eine kleine Hilfe für arme Info-Studenten. Ich weiß nicht, ob /etc/group parsen das Sinnigste ist, aber es ist das Erste, was mir gerade einfällt ;)
#! /bin/bash
# Name
echo -n "Username:"
read name
#home
echo -n "Homeverzeichnis:"
read home
#Gruppe
echo -n "Gruppe:"
read gruppe
#Kommentar
echo -n "Kommentar:"
read kommentar
if [ "$gruppe" != "" ] && [ "$home" != "" ] && [ "$gruppe" != "" ] && [ "$kommentar" != "" ]
then
useradd -m -d $home -g $gruppe -c "$kommentar" $name
else
echo "keine eingabe"
fi
#!/bin/sh
# max_update.sh: Parst die Config-Datei von php, setzt upload_max_filesize auf den neuen Wert,
# kopiert die alte cfg zum Backup
# Variablen
CFGFILE=/usr/local/php5/etc/php.ini
CFGVAR=upload_max_filesize
TMPDIR=/tmp/
tsp=`date +%Y%m%d%H%M%S`
OUT=$TMPDIR$tsp
# Zeilenweise durch das CFGFILE gehen und die gewuenschte CFGVAR setzen
while read var eq attrib
do
if expr "$var" : 'upload_max_filesize' > 0
then
attrib=$1
echo "$var $eq $attrib" 1>&3
else
echo "$var $eq $attrib" 1>&3
fi
done <"$CFGFILE" 3>"$OUT"
# Das alte CFGFILE wech sichern und das neue einsetzen
BACKUP=$CFGFILE$tsp
/bin/mv $CFGFILE $BACKUP
/bin/mv $OUT $CFGFILE
# Flagdatei fuer Apacheneustart setzen
echo > /usr/local/php5/etc/restart_apache
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment