Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the sdffs scritp and configuration
- Loading branch information
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Change this to your local user id and local groupd id | ||
UserID= | ||
GroupID= | ||
# Change this to your user on SDF | ||
SDFID= | ||
# Change this to your home path on SDF | ||
RemotePath= | ||
LocalPath= | ||
# Change this to the server you connect on SDF | ||
Server= | ||
# Change this to the server your connect on port 443 on SDF | ||
Server443= | ||
# Change this to all sleep use on this script | ||
Sleep=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/sh | ||
|
||
source $HOME/.myscripts/sdffs | ||
|
||
# Version of the script | ||
Version=29 | ||
|
||
case $1 in | ||
|
||
mount) | ||
|
||
if [ ! -e $LocalPath ]; then | ||
echo -n "Creating the mounting dir " | ||
sudo mkdir -p $LocalPath | ||
sudo chown -R $UserID:$GroupID $LocalPath | ||
sleep $Sleep | ||
echo -e "\033[40;31;1;5m [ Ok ] \033[m" | ||
fi | ||
|
||
PStat=$(ps aux | grep sshfs | grep -v grep | grep "$RemotePath") | ||
if [ "$PStat" == "" ]; then | ||
|
||
echo -n "Mount your dir at SDF Public Access Unix System" | ||
if [ -z $2 ]; | ||
then | ||
/usr/bin/sshfs $SDFID@$Server:$RemotePath \ | ||
$LocalPath | ||
else | ||
/usr/bin/sshfs -p $2 $SDFID@$Server443:$RemotePath \ | ||
$LocalPath | ||
fi | ||
|
||
echo -e "\033[40;31;1;5m [ Enjoy !!! ] \033[m" | ||
|
||
else | ||
echo "Your dir at SDF Public Access Unix System is already mounted " | ||
fi | ||
|
||
;; | ||
umount) | ||
PStat=$(ps aux | grep sshfs | grep -v grep | grep "$RemotePath") | ||
if [ "$PStat" != "" ]; then | ||
|
||
echo -n "Umount your dir at SDF Public Access Unix System" | ||
sudo /bin/umount $LocalPath | ||
sleep $Sleep | ||
echo -e "\033[40;31;1;5m [ Ok ] \033[m" | ||
else | ||
echo "Your dir isn't mounted at SDF Public Access Unix System" | ||
fi | ||
|
||
;; | ||
|
||
status) | ||
PStat=$(ps aux | grep sshfs | grep -v grep | grep "$RemotePath") | ||
if [ "$PStat" != "" ]; then | ||
Status=" Online" | ||
else | ||
Status=" Offline" | ||
fi | ||
|
||
echo -e "Status of sdffs service is \033[40;34;1;5m $Status \033[m" | ||
if [ "$Status" = " Online" ]; then | ||
echo $PStat | awk -F" " '{print "\033[40;34;1;5mRemote FS: \033[m" $12" \033[40;34;1;5mMounted on: \033[m"$13}' | ||
fi | ||
;; | ||
update) | ||
Check_Version | ||
;; | ||
*) | ||
echo -e "Script Version \033[40;34;1;5m$Version\033[m" | ||
echo "Use: $0 mount [port]" | ||
echo " $0 umount " | ||
;; | ||
esac |