User:Mihho/test: Difference between revisions

From IThelp
mNo edit summary
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
= University of Bergen | IT department =
testing
__NOTOC__
<div class="w3-container">
  <div class="w3-row">
    <div class="info w3-col s12 m3 l4">
<htmlet>ithelp</htmlet>
    </div>
    <div class="info w3-col s12 m3 l4">
<rss "title=off">http://meldinger.uib.no/rss.php?meldingstype=itdrift</rss>
'''[http://meldinger.uib.no/itdrift.php?modus=arkiv >> Arkiv]'''
{{:News}}
'''[https://it.uib.no/Aktuelt >> Norwegian news ]'''
{{:Support}}
{{:Email}}
{{:Private computer}}
    </div>
</div>
<div class="w3-row">
    <div class="info w3-col s12 m6 l3">
{{:Software}}
{{:Print services}}
{{:Services from the IT department}}
''[[Services from the IT department|>> More IT services]]'''
    </div>
</div>


<div class="w3-row">
<source lang=bash>
  <div class="w3-row w3-container w3-deep-purple">
#!/bin/bash
[[no:Hovedside]]
# DIKULT105: lager kataloger for gruppene/prosjektene
Address: Postboks 7800 5020 Bergen
# NB: katalogenen må være lesbare på nett
Visiting address: Nygårdsgaten 5
# August 2013 - BS-259848
Phone: (+47) 55584700
# Studentens navn må anonymiseres i url'en. Dette gjøres med en autogenerert streng som knyttes til brukerens uid.
Fax: (+47) 55584070
# Epost må sendes ut til hver enkelt student, og her burde det vel funke med username@uib.no
  </div>
 
   </div>
HOMEDIR="/var/www/kurs/dikult105-test/"
   </div>
DIKULTLDAPGROUPS=`ldapsearch -x -H ldap://frost.uib.no cn=vev_dikult105* | grep 'vev_dikult105_' | grep -v '#' | grep 'cn:' | sed 's/cn: //g'`
DIKULT105_MEMBERS=`getent group vev_dikult105 | sed 's/vev_dikult105:\*:9290://g' | sed 's/,/ /g'`
ASSIGNMENTFOLDERS="assignment1 assignment2 assignment3"
 
echo "cd $HOMEDIR"
 
for k in $DIKULTLDAPGROUPS;do
  DIKULTGROUPNAME=`echo $k | sed s/vev_//g`
  echo "mkdir $DIKULTGROUPNAME"
  echo "chown apache:$k $DIKULTGROUPNAME"
  echo "chmod 770 $DIKULTGROUPNAME"
  DIKULTGROUP_MEMBERS=`getent group $k | sed 's/vev_dikult105.*:\*:.*://g' | sed 's/,/ /g'`
done;
 
for j in $ASSIGNMENTFOLDERS;do
  echo "mkdir $j"
  echo "chown fafdj $j"
  echo "cd $j"
  for i in $DIKULT105_MEMBERS;do
    USERSNAME=`getent passwd $i | awk -F':' '{print \$5 }' | sed 's/ /_/g'`
    FOLDER=`./randpwgen.sh`
    echo "mkdir $FOLDER"
    echo "chown $i $FOLDER"
    echo "chmod 750 $FOLDER"
    echo "chgrp apache $FOLDER"
    echo "# Sender epost til $USERSNAME..."
    echo "echo \"Din unike kode til Dikult105 er: $FOLDER\" | mail -s \"Dikult105 kode\" $i@uib.no"
    echo $USERSNAME
   done;
   echo "cd .."
done;
 
</source>

Latest revision as of 08:24, 20 March 2018

testing

#!/bin/bash
# DIKULT105: lager kataloger for gruppene/prosjektene
# NB: katalogenen må være lesbare på nett
# August 2013 - BS-259848
# Studentens navn må anonymiseres i url'en. Dette gjøres med en autogenerert streng som knyttes til brukerens uid.
# Epost må sendes ut til hver enkelt student, og her burde det vel funke med username@uib.no

HOMEDIR="/var/www/kurs/dikult105-test/"
DIKULTLDAPGROUPS=`ldapsearch -x -H ldap://frost.uib.no cn=vev_dikult105* | grep 'vev_dikult105_' | grep -v '#' | grep 'cn:' | sed 's/cn: //g'`
DIKULT105_MEMBERS=`getent group vev_dikult105 | sed 's/vev_dikult105:\*:9290://g' | sed 's/,/ /g'`
ASSIGNMENTFOLDERS="assignment1 assignment2 assignment3"

echo "cd $HOMEDIR"

for k in $DIKULTLDAPGROUPS;do
  DIKULTGROUPNAME=`echo $k | sed s/vev_//g`
  echo "mkdir $DIKULTGROUPNAME"
  echo "chown apache:$k $DIKULTGROUPNAME"
  echo "chmod 770 $DIKULTGROUPNAME"
  DIKULTGROUP_MEMBERS=`getent group $k | sed 's/vev_dikult105.*:\*:.*://g' | sed 's/,/ /g'`
done;

for j in $ASSIGNMENTFOLDERS;do
  echo "mkdir $j"
  echo "chown fafdj $j"
  echo "cd $j"
  for i in $DIKULT105_MEMBERS;do
    USERSNAME=`getent passwd $i | awk -F':' '{print \$5 }' | sed 's/ /_/g'`
    FOLDER=`./randpwgen.sh`
    echo "mkdir $FOLDER"
    echo "chown $i $FOLDER"
    echo "chmod 750 $FOLDER"
    echo "chgrp apache $FOLDER"
    echo "# Sender epost til $USERSNAME..."
    echo "echo \"Din unike kode til Dikult105 er: $FOLDER\" | mail -s \"Dikult105 kode\" $i@uib.no"
    echo $USERSNAME
  done;
  echo "cd .."
done;