Discord Moderator plowmanplow Posted March 10, 2013 Discord Moderator Posted March 10, 2013 I wanted a way to automatically include MystCraft ages into GroupManager's world permissions. I have seen an option for the GroupManager config.yml which would match any world name (specifically the "all_unnamed_worlds) in the Github source but haven't had any luck with that. Enter inotify. The Linux kernel has the ability to watch files/directories for changes. I have written a script that watches two of these: 1) Watch the TekkitLite.jar file for "CLOSE_NOWRITE" which will throw an event if TekkitLite.jar was previously opened for reading (i.e. when the server starts) and was subsequently closed. On this event the monitoring script simply terminates itself. 2) Watch the "worlds" folder under GroupManger for the creation of new directories with the assumption that this would be a user entering a new age. The script will copy the files from an existing "good" world's permissions into the newly created directory and then push a "manload" command into the Tekkit server (running inside a "screen" session of course) to reload GroupManager's world permissions. Simply execute the script in the background (i.e. "sh myst_inotify.sh &") from withing your launcher script directly before running the Java/Tekkit process. The Script: (myst_inotify.sh) #!/bin/sh screen=/usr/bin/screen scrname=minecraft TEKKITDIR=$HOME/minecraft TEKKITJAR=$TEKKITDIR/TekkitLite.jar GMWORLDS=$TEKKITDIR/plugins/GroupManager/worlds GOODPERMSDIR=$TEKKITDIR/plugins/GroupManager/worlds/overworld MYPID=$$ inotifywait -m --format '%e %w %f' -e create -e close_nowrite "$TEKKITJAR" "$GMWORLDS" | while read event dir file; do FPTARGET=${dir}${file} if [ $event == "CREATE,ISDIR" ]; then cp "$GOODPERMSDIR"/* "$FPTARGET" $screen -d -r $scrname -p 0 -X stuff "$(printf '\r')" $screen -d -r $scrname -p 0 -X stuff "manload $(printf '\r')" fi if [ "$dir" == "$TEKKITJAR" ]; then kill -9 `pgrep -P $MYPID -n -x inotifywait` fi done Quote
Teraku Posted March 11, 2013 Posted March 11, 2013 That is pretty impressive. You should post that in the Server Op Swap Shop. Quote
Discord Moderator plowmanplow Posted March 22, 2013 Author Discord Moderator Posted March 22, 2013 This is no longer required since the latest Essentials builds (which at least work with BukkitForge build 245 and server 0.6.1) now has a config option for "all_unnamed_worlds" which catches all the mystcraft dimensions. Handy. Quote
Vapor_Craft Posted August 7, 2013 Posted August 7, 2013 Word for Thought. If a mystcraft age is loaded and you do the command /manload, that mystcraft world will be added to the worlds dir in the group manager's list of worlds. meaning it now has its own groups & users ymls. All that will equal that it is no longer mirrored with your "world" groups and users. Quote
Discord Moderator plowmanplow Posted August 7, 2013 Author Discord Moderator Posted August 7, 2013 Wow, quite the necro post. Anyone still using GroupManager perms might want to check out just about any other solution. There are a ton available and they ALL work better. Quote
Vapor_Craft Posted August 7, 2013 Posted August 7, 2013 Wow, quite the necro post. Anyone still using GroupManager perms might want to check out just about any other solution. There are a ton available and they ALL work better. what ya mean Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.