User:Mihho/test: Difference between revisions

From IThelp
mNo edit summary
No edit summary
 
(13 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 w3-red">
    <div class="info w3-col m6 l6">
<htmlet>ithelp</htmlet>
<hr>{{:Software}}
<hr>{{:Print services}}
<hr>{{:Services from the IT department}}
<hr>''[[Services from the IT department|>> More IT services]]'''
    </div>
    <div class="info w3-col m6 l4">
<rss "title=off">http://meldinger.uib.no/rss.php?meldingstype=itdrift</rss>


'''[http://meldinger.uib.no/itdrift.php?modus=arkiv >> Arkiv]'''
<source lang=bash>
<hr>
#!/bin/bash
{{:News}}
# DIKULT105: lager kataloger for gruppene/prosjektene
'''[https://it.uib.no/Aktuelt >> Norwegian news ]'''
# NB: katalogenen må være lesbare på nett
<hr>{{:Support}}
# August 2013 - BS-259848
<hr>{{:Email}}
# Studentens navn må anonymiseres i url'en. Dette gjøres med en autogenerert streng som knyttes til brukerens uid.
<hr>{{:Private computer}}
# 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 class="w3-row">
DIKULTLDAPGROUPS=`ldapsearch -x -H ldap://frost.uib.no cn=vev_dikult105* | grep 'vev_dikult105_' | grep -v '#' | grep 'cn:' | sed 's/cn: //g'`
  <div class="w3-row">
DIKULT105_MEMBERS=`getent group vev_dikult105 | sed 's/vev_dikult105:\*:9290://g' | sed 's/,/ /g'`
[[no:Hovedside]]
ASSIGNMENTFOLDERS="assignment1 assignment2 assignment3"
Address: Postboks 7800 5020 Bergen
 
Visiting address: Nygårdsgaten 5
echo "cd $HOMEDIR"
Phone: (+47) 55584700
 
Fax: (+47) 55584070
for k in $DIKULTLDAPGROUPS;do
  </div>
  DIKULTGROUPNAME=`echo $k | sed s/vev_//g`
  </div>
  echo "mkdir $DIKULTGROUPNAME"
  </div>
  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;