Hi,
I tried to edit the ‘startup.xml’ file as mentioned in the blog:
http://blog.ianbeyer.com/wowza-startup-packages/
My “startup.xml” file path was: /opt/working/default_2.2
The file contents are:
<Startup>
<Commands>
<Install>
<Folder>wowza</Folder>
</Install>
<RunScript>
<Script>tuning/tune.sh</Script>
<Script>mount.sh</Script>
</RunScript>
</Commands>
</Startup>
The “mount.sh” file is at the same location as startup.xml.
Its contents are:
#!/bin/sh
logmsg="/usr/bin/logger -t WowzaUserScript "
$logmsg "Wowza Mount Script"
#create Wowza Content and Logs folder in mnt
if ! [ -d /mnt/WowzaMediaServer ]; then
$logmsg "Creating /mnt/WowzaMediaServer dir"
mkdir /mnt/WowzaMediaServer
mkdir /mnt/WowzaMediaServer/content
mkdir /mnt/WowzaMediaServer/logs
$logmsg "Created Wowza content and logs directories"
fi
#create required keys
export AWSACCESSKEYID=XXX
export AWSSECRETACCESSKEY=YYY
#create config directory and mount it
if ! [ -d /mnt/config ]; then
$logmsg "Creating /mnt/config dir"
mkdir /mnt/config;
fi
s3fs ABC -o default_acl=public-read /mnt/config
$logmsg "Mounted /mnt/config dir"
#copy the loadbalancertargets.txt file
cp -f /mnt/config/loadbalancertargets.txt /home/wowza/conf
$logmsg "Copied /mnt/config/loadbalancertargets.txt to /home/wowza/conf"
#umonunt config and delete the folder
fusermount -uz /mnt/config
$logmsg "Unmount /mnt/config"
#mount today's bucket
if ! [ -d /mnt/`date +%Y%m%d`]; then
mkdir /mnt/`date +%Y%m%d`;
$logmsg "Created today's directory: /mnt/`date +%Y%m%d`"
fi
s3fs ABC-53e39950-0b63-48dc-8e5d-098c62b97440-`date +%Y%m%d` -o default_acl=public-read /mnt/`date +%Y%m%d`
$logmsg "Mounted today's directory: /mnt/`date +%Y%m%d` with bucket: ABC-53e39950-0b63-48dc-8e5d-098c62b97440-`date +%Y%m%d`"
#mount tomorrow's bucket
if ! [ -d /mnt/`date --date="tomorrow" +%Y%m%d`]; then
mkdir /mnt/`date --date="tomorrow" +%Y%m%d`;
$logmsg "Created tomorrow's directory: /mnt/`date --date=\"tomorrow\" +%Y%m%d`"
fi
s3fs ABC-53e39950-0b63-48dc-8e5d-098c62b97440-`date --date="tomorrow" +%Y%m%d` -o default_acl=public-read /mnt/`date --date="tomorrow" +%Y%m%d`
$logmsg "Mounted tomorrow's directory: /mnt/`date --date=\"tomorrow\" +%Y%m%d` with bucket: ABC-53e39950-0b63-48dc-8e5d-098c62b97440-`date --date=\"tomorrow\" +%Y%m%d`"
$logmsg "Wowza Mount Script Completed"
I then created a AMI of this Wowza server EC2 instance, say ami-123abc
When I created a new instance from the AMI “ami-123abc”, the above mount.sh script did not run when the server started.
Any pointers will be helpful.
Thanks,
Karuna.