What's new

CD to the right folder

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Master3395

Regular Contributor
Hello.
I was wondering if someone knows how to cd to the right folder.
To run a sh file?

\\RT-AC88U-EC48\entware\share\www\lighttpd\ths\start.sh

I've tried using cd, to get to the folder, but i can't seem to get away from entware...

Skjermbilde.PNG


Admin@RT-AC88U-EC48:/tmp/mnt/256GB-GoFlex/entware/share/www/lighttpd/ths#

chmod 777 start.sh
./start.sh (Makes an error, that i will be showing below.

./start.sh: line 10: syntax error: unexpected end of file (expecting "do")

This is the "start" file.
# /bin/sh
while true
do
echo Starting Bot
node bot.js
echo Restarting Bot in 5 Seconds...
sleep 5
done

I also tried making the bot start there "forever".
But that didn't give me any good

# /bin/sh
forever ./bot.js

At the end i tried this below.

cd /mnt - then ls, cd to the drives mounted point, cd to entware, and so on

Then i did
opkg install findutils-locate && updatedb && locate entware

https://silversunset.net/dbm/tutori...47-restarting-the-bot-automatically-foreverjs

Adding my two files, that i wish to try.
But i can't seem to find a way to use SSH, to get to the right folder, then run the file.
 

Attachments

  • start.sh.txt
    109 bytes · Views: 296
  • forever.sh.txt
    33 bytes · Views: 333
Last edited:
Just about everything you've shown is an error of some sort.

1. I can't see in what you've posted the cd command you said you used that didn't work.
2. The start.sh that you run is failing because it has been created in DOS format instead in Linux.
3. The first line of start.sh is incorrect, it should be:
Code:
#!/bin/sh
4. The first line of forever.sh is also incorrect because the router doesn't have bash.
 
Below is where my folder with my files is located.
And i had issues cd-ing to it.
But i got a working away, from freenode IRC

Admin@RT-AC88U-EC48:/tmp/mnt/256GB-GoFlex/entware/share/www/lighttpd/ths#
cd /mnt

Then i did cd /entware etc so i got to ths#
Then i did

chmod 777 start.sh
./start.sh (Makes an error, that i will be showing below.
./start.sh: line 10: syntax error: unexpected end of file (expecting "do")

And as you said that the first line is wrong, I'm not sure what to post in it.

# /bin/sh
while true
do
echo Starting Bot
node bot.js
echo Restarting Bot in 5 Seconds...
sleep 5
done
 
You should correct the errors in points 3. and 4. using the code I showed you.

Then fix the start.sh file with the following command:

dos2unix start.sh
 
Just tried that, got this.

upload_2019-1-19_17-8-14.png


Skjermbilde.PNG



You should correct the errors in points 3. and 4. using the code I showed you.

Then fix the start.sh file with the following command:

dos2unix start.sh
 
Just installed these
Skjermbilde.PNG


Then i tried re-running your dos2 code.
It returned no info

Skjermbilde.PNG
 
If i do this, i get illegal instructions.

I want the bot to run, and restart only if it stops.

I don't want to restart it every 5 seconds.
It seems like it says in the output, that it restarts every 5 seconds.
But i don't see the bot running at all.

#!/bin/sh
while true
do
echo Starting Bot
node bot.js
echo
Restarting Bot in 5 Seconds...
sleep 5
done


upload_2019-1-19_17-49-20.png
 
#!/bin/sh
while true
do
echo Starting Bot
node bot.js
echo
Restarting Bot in 5 Seconds...
sleep 5
done
Also, the "Restarting Bot in 5 Seconds..." line is a syntax error because it should be part of the previous line. That should be creating another error message in your output. The fact that it isn't makes me think that you are not posting a real contents of the script, or you are running the script in a different way now.
 
It is starting and restarting every 5 seconds, but i can't see that it runs, as it restarts every 5 seconds heh
And you were right. restart part was supposed to be on the side of the echo.
upload_2019-1-19_18-13-33.png
 
Like I said, the "Illegal instruction" message means that the "node bot.js" command is crashing. Probably because it is not compatible with your router.
 
I no longer get the illegal instruction error.
It was because of a syntax error i made.
But even if it says it's going to take 5k seconds, i don't see it running on the discord.
So i don't think the bot is running at all
Or it can't show to the world.

upload_2019-1-19_18-19-59.png
 
Last edited:
All files except start and forever is using samba.
The other 2 is done in ssh.
 
That might be it.
But I'm not sure why it says illegal instruction now.

I'm guessing that the first time you created those files was over Samba which is why they were in DOS format.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top