LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-15-2021, 08:31 PM   #1
jrb0031
LQ Newbie
 
Registered: Feb 2021
Posts: 6

Rep: Reputation: Disabled
curl and unzip/delete zip on ubuntu 20.04 server


change in tact..

kindly seeking expertise to clean up the below code into something useful..

Code:
mkdir /dev/sda2 slop
curl -o slop.zip <INSERT URL> /dev/sda2 slop
unzip slop.zip -d /dev/sda2 slop
rm -f slop.zip
trying to make a directory "slop" in sda2, download a zip from https source, unzip contents to "slop", and delete the zip..

desired end state being able to use "./startserver.sh" to get a mc server running on my RPi4..

for anyone interested, server source: https://www.curseforge.com/minecraft...wnload/3195280

lsblk below:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 48.9M 1 loop /snap/core18/1949
loop1 7:1 0 48.9M 1 loop /snap/core18/1990
loop2 7:2 0 61.7M 1 loop /snap/lxd/19206
loop3 7:3 0 61.6M 1 loop /snap/lxd/19040
loop4 7:4 0 27M 1 loop /snap/snapd/10709
loop5 7:5 0 27M 1 loop /snap/snapd/11043
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 256M 0 part /boot/firmware
└─sda2 8:2 0 465.5G 0 part /

Last edited by jrb0031; 02-15-2021 at 09:09 PM. Reason: edited link to navigate direct to server.zip versus the main page
 
Old 02-15-2021, 08:58 PM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by jrb0031 View Post
change in tact..

kindly seeking expertise to clean up the below code into something useful..

Code:
mkdir /dev/sda2 slop
curl -o slop.zip <INSERT URL> /dev/sda2 slop
unzip slop.zip -d /dev/sda2 slop
rm -f slop.zip
trying to make a directory "slop" in sda2, download a zip from https source, unzip contents to "slop", and delete the zip..

desired end state being able to use "./startserver.sh" to get a mc server running on my RPi4..

for anyone interested, server source: https://www.curseforge.com/minecraft...-pi2-atm-slop2

lsblk below:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 48.9M 1 loop /snap/core18/1949
loop1 7:1 0 48.9M 1 loop /snap/core18/1990
loop2 7:2 0 61.7M 1 loop /snap/lxd/19206
loop3 7:3 0 61.6M 1 loop /snap/lxd/19040
loop4 7:4 0 27M 1 loop /snap/snapd/10709
loop5 7:5 0 27M 1 loop /snap/snapd/11043
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 256M 0 part /boot/firmware
└─sda2 8:2 0 465.5G 0 part /
Waste of time it is not there, startserver.sh, in any of the directories it could be in in the archive.

Code:
root@buster-raspi:~# mkdir test
root@buster-raspi:~# mv SLOP+2-2.1.0.zip test/
root@buster-raspi:~# cd test
root@buster-raspi:~/test# unzip SLOP+2-2.1.0.zip 
Archive:  SLOP+2-2.1.0.zip
  inflating: manifest.json           
  inflating: modlist.html            
   creating: overrides/
   creating: overrides/config/
  inflating: overrides/config/aiimprovements-common.toml 
snip...
root@buster-raspi:~/test# ls -l
total 1924
-rw-r--r-- 1 root root     9443 Feb  7 02:36 manifest.json
-rw-r--r-- 1 root root    11400 Feb  7 02:36 modlist.html
drwxr-xr-x 6 root root     4096 Feb  7 02:36 overrides
-rw-r--r-- 1  502 staff 1941009 Feb 15 22:46 SLOP+2-2.1.0.zip
 root@buster-raspi:~/test# find . -name start
./overrides/kubejs/startup_scripts
And for the removal of the zip firstly and the useless directory after that..

Code:
root@buster-raspi:~/test# rm SLOP+2-2.1.0.zip 
root@buster-raspi:~/test# ls -l
total 28
-rw-r--r-- 1 root root  9443 Feb  7 02:36 manifest.json
-rw-r--r-- 1 root root 11400 Feb  7 02:36 modlist.html
drwxr-xr-x 6 root root  4096 Feb  7 02:36 overrides
root@buster-raspi:~/test# cd ../
root@buster-raspi:~# ls -l
total 24
drwxr-xr-x 2 root root  4096 Feb 11 16:09 bin
-rw-r--r-- 1 root root 16161 Feb  7 15:05 selections.txt
drwxr-xr-x 3 root root  4096 Feb 15 23:00 test
root@buster-raspi:~# rm -r test
root@buster-raspi:~# ls -l
total 20
drwxr-xr-x 2 root root  4096 Feb 11 16:09 bin
-rw-r--r-- 1 root root 16161 Feb  7 15:05 selections.txt
Edit2: You do not make a directory on /dev/sda2 you make a directory in the file system contained on the /dev/sda2 your / directory of your install. Above I showed the commands with me in /root/ my root users home (~) directory that is shown root@buster-raspi:~#. in the shell prompt. Since you use Ubuntu your root user will be disabled you would use sudo for any command that required root level privileges to run.

Last edited by HappyTux; 02-15-2021 at 09:14 PM. Reason: additional information
 
Old 02-15-2021, 09:06 PM   #3
jrb0031
LQ Newbie
 
Registered: Feb 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by HappyTux View Post
Waste of time it is not there, startserver.sh, in any of the directories it could be in in the archive.
did you pull the server zip though? from the quoted code, looks like that may have been the user file, "SLOP 2-2.1.0.zip" versus the "server.zip"

Should be in this one though:https://www.curseforge.com/minecraft...wnload/3195280

but wow-- thank you for trying to run it to see what was going wrong!!
 
Old 02-15-2021, 09:51 PM   #4
jrb0031
LQ Newbie
 
Registered: Feb 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by HappyTux View Post
Edit2: You do not make a directory on /dev/sda2 you make a directory in the file system contained on the /dev/sda2 your / directory of your install. Above I showed the commands with me in /root/ my root users home (~) directory that is shown root@buster-raspi:~#. in the shell prompt. Since you use Ubuntu your root user will be disabled you would use sudo for any command that required root level privileges to run.
okay, i did pwd and return was /home/ubuntu.. i'm inferring this is on sda2 because i've used explorer on the sda1 and saw no home directory..

if your code was trying to lead me to water, and i'm just not seeing it, then i apologize-- i don't yet know enough to use critical thinking and am a copy/paste terminal archetype for now.. but i used some of your edit2 to rework the following:

Code:
sudo mkdir slop
cd slop
sudo curl -o server.zip <URL> 
sudo unzip server.zip
sudo rm -f server.zip
sudo ./starhserver.sh
i know part of the whole point is to "try things out" and "see if they work"... but I am just so tired of reinstalling every time i screw something up :C

p.s. my terminal starts with ubuntu@ubuntu:~$

thank you again for your time

edit1: tried the code as written above, but upon unzip it says--

Code:
ubuntu@ubuntu:~/slop$ ls
server.zip
ubuntu@ubuntu:~/slop$ sudo unzip server
Archive:  server.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of server or
        server.zip, and cannot find server.ZIP, period.

Last edited by jrb0031; 02-15-2021 at 10:11 PM. Reason: tried some stuffs n junks
 
Old 02-15-2021, 10:16 PM   #5
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by jrb0031 View Post
okay, i did pwd and return was /home/ubuntu.. i'm inferring this is on sda2 because i've used explorer on the sda1 and saw no home directory..

if your code was trying to lead me to water, and i'm just not seeing it, then i apologize-- i don't yet know enough to use critical thinking and am a copy/paste terminal archetype for now.. but i used some of your edit2 to rework the following:

Code:
sudo mkdir slop
cd slop
sudo curl -o server.zip <URL> 
sudo unzip server.zip
sudo rm -f server.zip
sudo ./starhserver.sh
i know part of the whole point is to "try things out" and "see if they work"... but I am just so tired of reinstalling every time i screw something up :C

p.s. my terminal starts with ubuntu@ubuntu:~$

thank you again for your time
On a Pi and any machine that will boot EFI the /dev/sda1 is usually a tiny fat partition to load the boot files.


Code:
root@buster-raspi:~/test# fdisk -l /dev/sda
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Disk model: ASM105x         
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: D8A96088-5191-480A-9498-EE006223808B

Device      Start       End   Sectors   Size Type
/dev/sda1      40    409639    409600   200M EFI System
/dev/sda2  409640 234441614 234031975 111.6G Linux filesystem
What is need for you now you know where you are at is to make the directory like I show with the name you want it to be, then move the file from where it is located to that directory. Once done you unzip then remove the server.zip. The file is there in the server.zip so it is just a matter of starting it. If you want it to keep running so you can close the Terminal or even reuse it then install the screen program then use screen for a command in the Terminal. It will start up and give you a virtual Terminal to type commands into. This is where you use the ./startserver.sh to start it up. Once happy it runs correctly then the CTRL key held down then the a and next d keys pressed while it is held down will detach the screen and leave it running for you. A screen -r will get you back into a running single session screen instance if more than one you need to know the process ID number it tells you when detaching to use screen -r 12345 for process 12345 or if you use the naming option when starting it then screen -r Name. The CTRL key held down then the q pressed twice while it is held down will kill off the running screen you are in and the program running in it. Or at the command line knowing the process ID number kill 12345. Good luck with it.


Code:
root@buster-raspi:~# mkdir test
root@buster-raspi:~# mv server.zip test/
root@buster-raspi:~# cd test/
root@buster-raspi:~/test# unzip server.zip 
Archive:  server.zip
  inflating: server-setup-config.yaml  
  inflating: startserver.bat         
  inflating: startserver.sh          
root@buster-raspi:~/test# rm server.zip
Edit: The startup script seems straight forward but I have no java installed on this thing to test it with, it is just a headless server for me no need for excess packages not required to be installed. Otherwise without that error it appears it would start once you make the file executable.....

Code:
oot@buster-raspi:~/test# ./startserver.sh 
bash: ./startserver.sh: Permission denied
root@buster-raspi:~/test# chmod +x startserver.sh 
root@buster-raspi:~/test# ./startserver.sh 
https://github.com/BloodyMods/ServerStarter/releases/download/v1.2.7/serverstarter-1.2.7.jar
DEBUG: (curl) Downloading https://github.com/BloodyMods/ServerStarter/releases/download/v1.2.7/serverstarter-1.2.7.jar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   631  100   631    0     0   2651      0 --:--:-- --:--:-- --:--:--  2651
./startserver.sh: line 36: java: command not found
root@buster-raspi:~/test# java --version
bash: java: command not found

Last edited by HappyTux; 02-15-2021 at 10:26 PM. Reason: more information.
 
Old 02-15-2021, 10:45 PM   #6
jrb0031
LQ Newbie
 
Registered: Feb 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by HappyTux View Post
Edit: The startup script seems straight forward but I have no java installed on this thing to test it with, it is just a headless server for me no need for excess packages not required to be installed. Otherwise without that error it appears it would start once you make the file executable.....

Code:
oot@buster-raspi:~/test# ./startserver.sh 
bash: ./startserver.sh: Permission denied
root@buster-raspi:~/test# chmod +x startserver.sh 
root@buster-raspi:~/test# ./startserver.sh 
https://github.com/BloodyMods/ServerStarter/releases/download/v1.2.7/serverstarter-1.2.7.jar
DEBUG: (curl) Downloading https://github.com/BloodyMods/ServerStarter/releases/download/v1.2.7/serverstarter-1.2.7.jar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   631  100   631    0     0   2651      0 --:--:-- --:--:-- --:--:--  2651
./startserver.sh: line 36: java: command not found
root@buster-raspi:~/test# java --version
bash: java: command not found
with this last piece it is working happily!! i am so happy i could kiss you right now my friend!! thank you thank you!!

p.s. one final note for posterity.. curseforge link was not working, but i found out that if you start the download on a pc you can then right-click to copy the actual, real link which in this case turned out to be https://media.forgecdn.net/files/3195/280/server.zip
 
Old 02-15-2021, 10:57 PM   #7
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by jrb0031 View Post
with this last piece it is working happily!! i am so happy i could kiss you right now my friend!! thank you thank you!!

p.s. one final note for posterity.. curseforge link was not working, but i found out that if you start the download on a pc you can then right-click to copy the actual, real link which in this case turned out to be https://media.forgecdn.net/files/3195/280/server.zip
You are welcome, good to see you have it working now. It can be a little difficult if not knowing the way around these systems. There were no personal computers when I was young, and when they came along with the TRS80, the first I touched, when in high school all they had were command lines. It is simple once you know it for most things anyways.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can I have zip -d file.zip "__MACOSX*" work on all zip files in directory? thomwblair Linux - Newbie 10 10-08-2018 02:30 PM
[SOLVED] Does "unzip -X" work in Info-ZIP UnZip 6.00? ruario Linux - Software 5 09-15-2013 04:21 AM
How to find out a file in a WAR which in a zip without unzip the zip-file? thomas2004ch Linux - Software 3 09-30-2011 03:06 PM
What is the difference between using "jar xvf" and "unzip" to unzip the zip-file? thomas2004ch Linux - Newbie 4 08-27-2009 05:11 AM
about unzip to unzip some chinese files' trouble arcow Linux - Software 0 03-24-2006 02:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration