I am using a shared file download service which deletes the file if the file's web page has not been visited in 30 days. I need to store my files for longer than 30 days.
I am using a Centos 7 based Linux server.
My idea was to create a cron to run a bash script with a command line for each file.
I have tried using the wget, curl and lynx commands but these do not register as the page being visited.
Any ideas on a command that I can use?
The file sharing service is gofile.io and an example file I have uploaded (on the page that is required to be visited) is https://gofile.io/?c=znRpuJ
Edit: After looking into it further there appears to be a javascript function which needs to be activated which I think isn't activated by wget/curl/lynx. Is there any way to activate this javascript from the command line?
Try this:
Make sure you have Python3.
Install geckodriver.
pip install selenium for Python3.
Run the following script:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://gofile.io/?c=znRpuJ"
driver.quit()
Good luck.
Related
I am using ansi-escapes to make the link.
How would I make it run a function when the link is clicked? I'm okay with making it run a terminal command. And if so is there some sort of URI that I can use to run a terminal command? I am using Windows Terminal, however I would like it to work for other terminals as well.
If you make a link with a file:/// uri to a batch file, Windows Terminal will run it, because it simply executes open ${url}. From that batch file you can then run something like node terminalCallback.js.
The only allowed uri protocols are:
http(s)
file
I am a freelancer and my clients need screenshots of all the work I did. So I made a python script which takes screenshots every 7 minutes and this code gets executed automatically when system starts. It worked perfectly in Ubuntu. This is the code.
Now I switched to Fedora34. I have modified my script litte bit which captures screenshots and saves in folders according to date rather than putting all screenshots in one directory. This is my script for Fedora
#!/usr/bin/env python
import pyscreenshot
import time
from datetime import datetime
import os
from pathlib import Path
while True:
# Get Current time
now = datetime.now()
# setting current datetime as image_filename
image_filename = now.strftime("%b-%d-%Y|%H:%M:%S")
# Getting month, year and date
today_month_year = now.strftime("%b-%Y")
today_date = now.strftime("%d")
new_directory = os.path.join(r"ss/",
str(today_month_year),
str(today_date))
# Create folders safely
Path(new_directory).mkdir(parents=True, exist_ok=True)
# To capture the screen
image = pyscreenshot.grab()
# To save the screenshot
image.save(new_directory + "/" + str(image_filename) + ".png")
# Each screenshot Every 7 minutes
time.sleep(420)
And fedora does not have Startup Applications app and gnome-tweaks > Startup Applications does not support custom scripts. So I searched at many sites and came to conclusion that I can create a service file. And I created a service file to start my script at startup with following code:
File: /etc/systemd/system/screenshots.service
[Service]
WorkingDirectory=/home/<uname>/path
ExecStart=/bin/sh -c 'cd /home/<uname>/path/ && source env/bin/activate && ./auto-ss.py'
Now when I run sudo systemctl start screenshots, it does not throw any error but running sudo systemctl status screenshots throws following error:
pyscreenshot.err.FailedBackendError: All backends failed!
According to this answer
PyScreenshot is for taking screenshots of desktop applications. Since your application is running on a server, there's nothing to take a screenshot of. If you intended to take a screenshot of the user's browser, you would use frontend tooling, which runs in the browser, not a server-side tool.
If this is the problem, how can I run my python app as frontend. And if its some other problem, how can I overcome it?
Can anyone help me. I am stuck on this since very long :( . Well, thanks in advance :)
If it works on Ubuntu and doesn't work for Fedora, the sure way to fix it is to mimic Ubuntu on Fedora (i.e. via desktop environments). Ubuntu uses gnome. So, your best bet is to use gnome on Fedora too.
Please have a look at these links:
What is the recommended way to install Gnome on Fedora 30 Server?
Install Gnome 3 in Fedora 22 KDE Spin
Fedora 32: Gnome Desktop
Im trying to run a .bat file on my server through php popen command, ive struggled and finally got to the point where all the permissions are set correctly and now i can actually execute the file but i have a problem. In my server logs it displays
foo.bat: line 1: mstsc: command not found, referer: http://dev.example.com
The full code in the file is mstsc /v:192.168.1.1 I know this means that it doesn't recognise the command on centos but im not sure what to do to fix the problem.
The aim of this code is to open RDP for the user who requested it. Bear in mind that this code works perfectly locally on my windows OS using xampp but when i upload it to the server running CENTOS it doesnt work.
My question is
How do i fix this error and allow CENTOS to execute a command that opens an RDP window for the user
MSTSC is a Windows RDP client which is why it works on Windows.
It's not available to run on CentOS, let alone call by executing a Windows batch file! You'll need to use an alternative solution like FreeRDP and use a script like this one if you want to do this from CentOS: https://www.server-world.info/en/note?os=CentOS_7&p=x&f=5
I feel like this is exactly what you're after
http://www.jjclements.co.uk/2010/02/21/rdp-hyperlink/
It allows you run a bat file that opens windows RDP without needing to write a single line of server code. Take a look its pretty good!
I'm receiving the below error at work (with a proxy) when running the Google Cloud SDK install script (gcloud.components.update) Unable to fetch /components-2.json
I've viewed this thread
Error while installing Google Cloud SDK in Cygwin : Unable to fetch https://dl.google.com/dl/cloudsdk/release/components-2.json
I've added in the proxy information and I can download the installer (if I don't set the proxy I can't access this).
curl /dl/cloudsdk/release/install_google_cloud_sdk.bash | bash
I can run curl https://dl.google.com/dl/cloudsdk/release/components-2.json
I'm running Python 2.7 and I'm on Windows XP. If its a proxy issue why can I download the files and access the page but can't run the login script?
I can download a local version of components-2.json I can also download all of the files that this file refers to.
Is there a config file I can edit to get it to look at the local versions of these files?
I can seems to find where the address /components-2.json is specified.
Cheers and thanks,
Rohan
PS sorry I couldn't include more than 2 links as I don't have a reputation, even though posting requirement mentions to show research.
As an alternative, please try the following:
Download google-cloud-sdk.zip or google-cloud-sdk.tar.gz
Unpack the archive
Run the ./google-cloud-sdk/install.sh script
This is described in small print on the Google Cloud SDK page, underneath the text box that suggests running the command you're likely using:
curl https://sdk.cloud.google.com | bash
I've created a very basic test using Selenium IDE and converted it into an HTML suite. I've setup a VM running CentOS 5.5 to perform Selenium tests.
When I try to use this command,
java -jar selenium-server-standalone-2.14.0.jar -multiwindow -htmlSuite "*firefox" "http://www.example.com" "login-test-suite.html" "sel-results.html"
I receive the following output with an exception http://pastie.org/2956400
Someone told me that Selenium is not able to find firefox in /usr/lib/firefox and that was correct, so I created a symlink
ln -s /usr/lib64/firefox-3.6 /usr/lib/firefox
But still getting the same error. I don't know how to create a profile in firefox via cli as I'm using SSH. My initial thought was Selenium should create a profile itself and if it can't, then definitely something is wrong.
I'll proceed to develop Selenium test in Python only when I get the simple htmlSuite test running.
I think suite file of your scripts folder, needs to be given folder permission to access by selenium. Hope we can give it in unix. Try to give the permission and try to run one more time. Hope this will help you.
Regards,
Neel