I am running Wordpress and NextCloud with Nginx on port 443 on my Webserver. I have it set up so that Wordpress is the dedicated homepage and it will ALWAYS load before NextCloud.

ISSUE: Wordpress does NOT use an external hard drive and loads within 3 seconds (the webserver is not the problem). However, Nextcloud DOES use an external hard drive and it requires to spin up the hard drive before you can log in (takes 15 seconds at least).

I WOULD LIKE TO: Make a script that to detects activity on port 443, so when someone accesses Wordpress (the homepage) the server can get a head start by spinning up the drive

How do I make a script that can detect activity on 443 and spin up the drive?

closed as unclear what you're asking by Scott, Archemar, Anthon, Satō Katsura, jasonwryan Sep 13 '17 at 7:43

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    How is your script going to be any faster than a webserver? – Tigger Sep 13 '17 at 6:03
  • I think you got a -1 because it is an unsolvable problem. Try this: Wait for the harddisk to spin down. Then run the command on your site curl -I http://example.org/. If this takes a long time, there is no way you can be ahead of spinning up the drive. – hschou Sep 13 '17 at 6:06

Rather than trying to spin the drive up in time for handling an incoming request (you can't do this faster than the web server anyway), don't allow the drive to spin down.

This can be done in a number of different ways. On Linux, you may want to try the hdparm utility (for SATA and IDE drives):

$ hdparm -B 128 device_name

Be sure to read the manual properly before using this utility.

See also relevant questions on the Ask Ubuntu site (answers are not specific to Ubuntu):

  • @TylerDeBoy Actually, stopping and starting the drive constantly will wear it out, not having it on 24/7. The only real reason to spin it down is for power reasons. – Chris Down Nov 17 '17 at 18:41
  • @TylerDeBoy What kind of drive is this? I would be surprised if the drive wore out during its warranty period. – Kusalananda Nov 17 '17 at 18:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.