root/trunk/misc/make_share.sh

Revision 126, 0.6 KB (checked in by mbooth, 8 months ago)

Add some handy bits of script that I've written over the years:

  • Shell script that creates and configures samba shares on the raid array.
  • Perl script that emails the admins of hosted websites when the box is going down for a sheduled reboot.
  • Python script that attempts to spot inconsistencies and errors in the DNS config for a given domain and subnet.
  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3# Automagically create a samba share on the raid array, owned by me, writable by anyone
4# in the users group and read-only to everyone else. Must be run as root.
5# Example usage:
6#  $ sudo ./make_share music
7
8set -x
9
10mkdir -p /raid/$1
11chown -R mbooth:users /raid/$1
12chmod -R ug+rwx,o+rx-w /raid/$1
13
14cat <<ENDOFSAMBACONFIG >> /etc/samba/smb.conf
15
16[$1]
17    comment = $1
18    path = /raid/$1
19    valid users = @users
20    force group = users
21    create mask = 0660
22    directory mask = 0771
23    writable = yes
24;   browseable = yes
25;   guest ok = yes
26
27ENDOFSAMBACONFIG
28
29/etc/init.d/smb restart
Note: See TracBrowser for help on using the browser.