Page 1 of 1

How to add Path properly?

Posted: Mon Jan 30, 2017 1:49 pm
by pandabb
Hello guys, it's me again panda! :)

Can you please help me with this little script i found on the net? Basically the script does is create a copy of backup to my mega storage account.

The script used is this - https://github.com/By-Vasiliy/VestaCP-S ... ps-to-mega


The problem

sudo /usr/local/vesta/bin/v-sync-backups-to-mega 21 200000 (DOES NOT WORK)
/usr/local/vesta/bin/v-sync-backups-to-mega 21 200000 (DOES WORK)

I think i need to add the path for the mega binaries which is /usr/local/bin and it's not yet included to root's bash profile.

Question:

How do i properly include the path /usr/local/vesta/bin to my bash profile below?

Should i just add PATH=$PATH:/usr/local/bin at the very bottom?
Or under the vesta bin
OR enclose it with export path PATH=$PATH:/usr/local/vesta/bin export path same wit vesta

Code: Select all

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
PATH=$PATH:/usr/local/vesta/bin
export PATH
THANKS!

Re: How to add Path properly?

Posted: Mon Jan 30, 2017 7:07 pm
by skurudo

Code: Select all

PATH=$PATH:/usr/local/vesta/bin
export PATH
I thinks this is it.

Re: How to add Path properly?

Posted: Tue Jan 31, 2017 4:08 pm
by pandabb
Thanks but SADLY tho it shows that my path are ok the script that i wanted to run via cron is still not working.

More help please ..


So i tried:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/vesta/bin

The script i'm trying to run is this - https://github.com/By-Vasiliy/VestaCP-S ... ps-To-Mega its for ubuntu, my os is Centos, i dont know if thats the reason why it's not working.

I added this to cron as per instruction of the author:
sudo /usr/local/vesta/bin/v-sync-backups-to-mega

i get this error:

Code: Select all

/usr/local/vesta/bin/v-sync-backups-to-mega: line 44: megals: command not found
/usr/local/vesta/bin/v-sync-backups-to-mega: line 52: megals: command not found
/usr/local/vesta/bin/v-sync-backups-to-mega: line 52: megals: command not found
/usr/local/vesta/bin/v-sync-backups-to-mega: line 52: megals: command not found
/usr/local/vesta/bin/v-sync-backups-to-mega: line 52: megals: command not found

Note: megals is existing already at /usr/local/bin

Code: Select all

[root@server bin]# ls -la
total 5624
drwxr-xr-x.  2 root root   4096 Jan 30 21:31 .
drwxr-xr-x. 15 root root   4096 Dec  8 00:39 ..
-rwxr-xr-x   1 root root 504493 Jan 29 10:03 megacopy
-rwxr-xr-x   1 root root 495996 Jan 29 10:03 megadf
-rwxr-xr-x   1 root root 511214 Jan 29 10:03 megadl
-rwxr-xr-x   1 root root 496693 Jan 29 10:03 megaget
-rwxr-xr-x   1 root root 499200 Jan 29 10:03 megals
-rwxr-xr-x   1 root root 494689 Jan 29 10:03 megamkdir
-rwxr-xr-x   1 root root 407447 Jan 29 07:39 megamv
-rwxr-xr-x   1 root root 496758 Jan 29 10:03 megaput
-rwxr-xr-x   1 root root 501162 Jan 29 10:03 megareg
-rwxr-xr-x   1 root root 494396 Jan 29 10:03 megarm
-rwxr-xr-x   1 root root 408330 Jan 29 07:39 megastream
-rwxr-xr-x   1 root root 415524 Jan 29 07:39 megasync
When i enter in megals, it does work on the terminal using root:

Code: Select all

[root@server mega]# megals
/Contacts
/Inbox
/Root

I've also verified the permission is root root and its executable.

[root@server bin]# ls -la v-sync-backups-to-mega
-rwxr-xr-x 1 root root 4120 Jan 29 08:48 v-sync-backups-to-mega


WHAT am i missing?

Btw, here's the link of the script again. https://github.com/By-Vasiliy/VestaCP-S ... ps-to-mega

based on the error it's on line 42 and 52


THANKS
Panda

Re: How to add Path properly?

Posted: Thu Mar 02, 2017 11:50 am
by skurudo
You missing ask aouthor of this script about this error? ;-)
Ask him on github or mail.

Re: How to add Path properly?

Posted: Wed Mar 21, 2018 11:49 am
by jose
hey! i have just the same error and permission denied in cronjob.

Did you solve this?

Re: How to add Path properly?

Posted: Thu Mar 22, 2018 7:03 am
by skurudo
jose, check permission or ask author on github about this error.