NathanFriend.co.uk

Developers notebook

Month: July 2010

BASH script to remove directories if they exist

I’d been asked to find out how we could automate deleting user folders from classroom macs.
Students save their work to the local disks and each academic year the home directories are deleted.  Some home directory have to be preserved.
I posted to the Kent Linux user group mailing list and soon had a solution.

Create a file call dir_list containing all the home directorys we want to delete, one per-line :
/Users/user1
/Users/user6
/Users/user33

Then create a file called remove.sh containing:
do
if [ -d $dir ]
then
rm -R $dir
echo “Directory $dir found and deleted.”
else
echo “Directory $dir not found.”
fi
done < dir_list

Run the script with ./remove.sh

MYSQL remote access

vi /etc/my.cnf

[mysqld]
bind-address=YOUR-SERVER-IP
# skip-networking

/etc/init.d/mysql restart

mysql> CREATE DATABASE foo;
mysql> GRANT ALL ON foo.* TO user;

http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Installing NX on OpenSUSE 11.2

When installing NoMachine (NX) on Open SUSE 11.2 you may get an error about missing library libaudiofile.so.0 install audiofile-32bit and audiofile-devel in YAST to resolve.

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑