Share directory tool, aka symlinks for v3

Read 30940 times
Let me be the first to contribute (and hopefully not the last).

This script will mount (bind-mount) a shared media directory within another station's media folder.


Download link:
-------------------
http://webcap.org/downloads/setmount.sh


Recommended installation instructions:
-------------------
mkdir -p /usr/local/centovacast/usr/sbin

wget http://webcap.org/downloads/setmount.sh -O /usr/local/centovacast/usr/sbin/setmount

chmod a+x /usr/local/centovacast/usr/sbin/setmount


You can find more details of usage within the script itself.


If you need help or have any questions/comments, please post them here so everyone can benefit from the discussion.

EDIT: Broken links updated
Last Edit: May 20, 2017, 03:02:06 am by Roger
After ~# /usr/local/centovacast/usr/sbin/setmount --add techno

Directory /usr/local/centovacast/var/vhosts/stream/var/spool/media will be bind to /usr/local/centovacast/var/vhosts/techno/var/spool/media/share

Press enter to continue, ctl+c to cancel:

Bind mount successful.

:~#

All files under /stream/var/spool/media were deleted. Can not even supposed to be...
After ~# /usr/local/centovacast/usr/sbin/setmount --add techno

Directory /usr/local/centovacast/var/vhosts/stream/var/spool/media will be bind to /usr/local/centovacast/var/vhosts/techno/var/spool/media/share

Press enter to continue, ctl+c to cancel:

Bind mount successful.

:~#

All files under /stream/var/spool/media were deleted. Can not even supposed to be...

Did you secure your files by setting read-only permissions? if not, then any DJ of the techno account with FTP access could have deleted them. There is a warning in the script notes about this.

Also, it seems that you changed the $SHAREPATH variable to a path within Centova Cast's chrooted environment (i.e another station's media folder). I didn't actually tested the script for this particular scenario as it is meant to share a directory outside Centova Cast's vhosts directory.

That said, it probably works just fine and someone just deleted the files, either that or /etc/fstab in your system uses a slightly different format for bind mounts.

Try removing the mount using the following command, and if your media folder returns to normal then it's a case of the latter.

/usr/local/centovacast/usr/sbin/setmount --remove techno


Regards.
Last Edit: October 15, 2017, 08:29:10 pm by Roger
Hi

Very good script but I have a problem, created share folder is empty.

My shared folder is /home/sharedmp3 with one mp3 to test
I have changed SharePath=/home/sharedmp3

The contents of my etc/fstab :

/dev/sda1       /       ext4    errors=remount-ro,relatime      0       1
/dev/sda2       /home   ext4    defaults,relatime       0       2
/dev/sda3       none    swap    defaults        0       0
proc            /proc   proc    defaults                0       0
sysfs           /sys    sysfs   defaults                0       0
tmpfs           /dev/shm        tmpfs   defaults        0       0
devpts          /dev/pts        devpts  defaults        0       0
tmpfs /var/amavis/db tmpfs rw,size=10m,mode=700,uid=amavis,gid=amavis  0 0
tmpfs /var/amavis/tmp tmpfs rw,size=150m,mode=700,uid=amavis,gid=amavis  0 0
/home/centovavhosts   /usr/local/centovacast/var/vhosts    none   bind
/home/sharedmp3  /usr/local/centovacast/var/vhosts/cookerseb/var/spool/media/share  none bind
/home/sharedmp3  /usr/local/centovacast/var/vhosts/djm/var/spool/media/share  none bind

The /home/sharedmp3 and share folder created which user owner/group and chmod they should have?

As you can see a few month I already moved centova vhosts to home because usr partition was too small :/home/centovavhosts   /usr/local/centovacast/var/vhosts    none   bind
Is my problem come from this ?

Thanks

As you can see a few month I already moved centova vhosts to home because usr partition was too small :/home/centovavhosts   /usr/local/centovacast/var/vhosts    none   bind
Is my problem come from this ?

Thanks

Hello fhisupport,

Sorry about the delay on this reply, the answer is yes (most likely), try changing the "VHOSTPATH=" variable to "/home/centovavhosts"


HTH
Hello,
When trying to add a user for sharing:
# /usr/local/centovacast/usr/sbin/setmount.sh --add elienazio


I get the following error message:
-bash: /usr/local/centovacast/usr/sbin/setmount.sh: No such file or directory


I do not understand because I see that this file "setmount" is precisely located in the correct location:
"/ usr / local / centovacast / usr / sbin / setmount"
Hello,
When trying to add a user for sharing:
# /usr/local/centovacast/usr/sbin/setmount.sh --add elienazio


I get the following error message:
-bash: /usr/local/centovacast/usr/sbin/setmount.sh: No such file or directory


I do not understand because I see that this file "setmount" is precisely located in the correct location:
"/ usr / local / centovacast / usr / sbin / setmount"

That is because setmount.sh doesn't exist, either that or you didn't apply executable permissions correctly, if you followed the download instructions so that the script file is called "setmount" you should instead use use:

/usr/local/centovacast/usr/sbin/setmount --add username

If however you can see "setmount.sh" with the "sh" extension, then just re-set permissions like so:

chmod 755 /usr/local/centovacast/usr/sbin/setmount.sh

HTH
Hello,
I gave permission that way:
chmod 755 / usr / local / centovacast / usr / sbin / setmount

When trying to add the user, I get the error message on the line 130 of the script

# sh /usr/local/centovacast/usr/sbin/setmount --add correcao
: command not foundast/usr/sbin/setmount: line 39:
: command not foundast/usr/sbin/setmount: line 44:
: command not foundast/usr/sbin/setmount: line 47:
: command not foundast/usr/sbin/setmount: line 50:
: command not foundast/usr/sbin/setmount: line 52:
: command not foundast/usr/sbin/setmount: line 55:
/usr/local/centovacast/usr/sbin/setmount: line 130: syntax error: unexpected end of file
Hello,
I gave permission that way:
chmod 755 / usr / local / centovacast / usr / sbin / setmount

When trying to add the user, I get the error message on the line 130 of the script

# sh /usr/local/centovacast/usr/sbin/setmount --add correcao
: command not foundast/usr/sbin/setmount: line 39:
: command not foundast/usr/sbin/setmount: line 44:
: command not foundast/usr/sbin/setmount: line 47:
: command not foundast/usr/sbin/setmount: line 50:
: command not foundast/usr/sbin/setmount: line 52:
: command not foundast/usr/sbin/setmount: line 55:
/usr/local/centovacast/usr/sbin/setmount: line 130: syntax error: unexpected end of file

Hello ozivaldo,

This script requires BASH and will not work with SH, if you continue to put "sh" in front of the actual command line it will never work.
Hello,

I need this script but the link (to dropbox) is no longer available.

If someone has this script, can reupload it to somewhere, or paste the code here?

Thanks.
Hello,

I need this script but the link (to dropbox) is no longer available.

If someone has this script, can reupload it to somewhere, or paste the code here?

Thanks.

Thank you for reporting this, and sorry that it has taken me couple of weeks to respond.

Unfortunately Dropbox has the habit of changing their method of sharing files, making it difficult to maintain a permanent link for an extended period of time.

I have now uploaded the script to a private domain, where it should remain available indefinitely.
Hello Roger,

I like to install your script but I think the link is dead..

...This Domain Name Has Expired..

Do you have an updated link please..

Thanks alot
Hello Pep, thank you for letting me know.

There was an issue with the domain's auto-renewal, should be fixed now :).
Thank Roger,

works fine now!!