cron won't run R script - r

I've tried running this a few different ways, but at the moment I have my crontab file as
MAILTO=email1#gmail.com,email2#gmail.com
40 10 * * * /home/me/my_script.sh
This my_script.sh is a shell script that runs an R script.
#!/bin/sh
/usr/bin/Rscript /home/me/stuff/daily_routine.R >> /home/me/stuff/output/outputstuff
If I just go to the terminal and run the following, though it works:
/home/me/my_script.sh
This R script downloads data from the internet. Could that be it? I've tried to include full paths everywhere, so I'm not sure that it's the PATH variable.
I never configured anything related to email, so I'm not sure how it is supposed to send it. Maybe that's it.
Edit:
It turned out that I had never installed and configured anything to send email. I ended up fixing the issue by installing and configuring ssmtp to send emails by using my gmail account. It took me a lot of fiddling around, so I'm not sure if I have a postable solution.
Also, I am not sure whether I should delete this question or keep it up. All of the cron tutorials I found are misleading--none of them mentioned having to do this.

Related

HTTP command not giving me forwarding URLs

Trying to use *grok to test out retrieving web hook requests from a third-party vendor, but when I try to use:
ngrok http 5001
I do not even get any UI response from ngrok. I have checked around this site, and other articles, and all of them were getting their forwarding URLs to use.
I tried working with the --log and --log-info arguments, but still nothing outputting in bash.
Okay, I'm on a Windows 10 machine when doing this, and it seems like the Git BASH terminal does not seem to work well. Though, the command prompt did worked well. Perhaps because the file was an .exe might explain it.

git repo access denied after months of no problems

Up until today, I've had no problem using GitHub to access my client's source repository. I've been happily working as a developer for 6 months on their project. Over the weekend I shut down my computer. Something I don't do very often. For the first time since the restart, I attempted to push a branch to the remote I get Authentication failed. You may not have permission.... git command line has the same issue. I figure it must have something to do with some environment variable that I had established and lost, or some configuration file that got overwritten somehow, but I don't know how to get it to work again. I'm looking for ~/.ssh/config file because some posts reference it in relation to this. I don't know where to go. git config --get-all doesn't produce any output. Too few parameters it says. Can anybody help me with this?

Can a rscript be aware of other Rscripts in ubuntu

I have a cron job that launches an Rscript to go fetch some data and stash it away in a database. Sometimes the source isn't ready so it waits. Sometimes the source skips a data point so the script ends up waiting until another instance is started from cron. Now that two instances are running they cause problems with each other. Is there something like the following pseudo code that I could put at the top of my scripts so they stop when they see another instance of themselves is already running:
stopifnot(Sys.running('nameofscript.r'))
One thing I thought to do would be for the script to make a temp file with a fixed name at the start and then delete that temp file at the end. This way the script can check for the existence of the file to know if it's already running. I also see there's something called flock which is probably a better solution than that but I'd prefer if there was a way R can do it without bash commands (I've never really learned any bash). If there isn't a pure R way to do this, can the R script call flock on itself or would it only work if the cron task calls a bash script that then calls the rscript. If it isn't already obvious, I don't really know how to use flock.

pam ftp send upon successful login

I've researched this feature extensively and need help. PAM is a difficult authentication program for me to thoroughly understand although I'm learning.
We have the option of running either ProFTPD or pure-ftpd on a VPS hosted by hostgator. The OS is CentOS release 5.11. I have complete access to the server. Our goal is to send an email upon successful FTP login by a user. I've successfully used a script which is run by PAM for notification emails dispatched upon successful SSH logins and need to modify it for successful FTP logins. That script which is amazing works fine with ssh (but we need ftp as I've mentioned) and can be viewed here:
http://blog.stalkr.net/2010/11/login-notifications-pamexec-scripting.html
Before I even try to wrap my head around why this script does not work using FTP, despite PAM working on our VPS (for at least ssh), can someone chime in with some theory as to why this is not working at all. I.E., maybe I'm way off base with this idea and it can't work with FTP and PAM in which case I'll just drop this approach. However, when I read configuration settings, etc., on using PAM with these two FTP programs, they seem to indicate this should work.
Additionally, running the following code which is supposed to test for PAM-enabled applications does not return FTP.
ldd /{,usr/}{bin,sbin}/* | grep -B 5 libpam | grep '^/'
Any suggestions or help from gurus would be greatly appreciated.
Found solutions. The answer was to include session_support=YES in the /etc/pam.d/vsftd configuration file. So that's the answer to anyone who may have a similar issue.

How do I get wkhtmltopdf running for a Drupal site on cPanel shared hosting?

First off, I will acknowledge that I am aware of another similar thread on the topic of wkhtmltopdf, but it was not similar enough to resolve my issue. Here's the other thread: wkhtmltopdf
Second, I will say that I have successfully used wkhtmltopdf with a Drupal site on a dedicated server that I run, where I installed the libX11 and used the most recent static version of wkhtmltopdf. That's on a CentOS 5 system and it runs nicely.
So, I have another hosting arrangement and I need to get the wkhtmltopdf to work, because it does the most amazing job producing bookmarked PDFs. The PDFs are beautiful.
The hosting is cPanel. I determined that it is on a server that has CentOS 5.5. It is not a problem to drop the static wkhtmltopdf in the print module's lib folder. However, I get the following message back in the Drupal admin status reports page (admin/reports/status).
It says,
"wkhtmltopdf library
The currently selected version of wkhtmltopdf () is not supported. Please update to a newer version."
I have obtained all of the needed .so files for CentOS 5, based on what jockie provided in his answer in the other StackOverflow thread.
Can someone knowledgeable confirm that his list was complete?
The idea of a shell script wrapper seems interesting and appears could be done for Drupal, if the naming of the shell script is called something like "wkhtmltopdf-wrapper.sh".
I have tried to use the shell script code that jockie provided, in a shell script. I did place all of the .so files in a sub-folder called "lib". I confess that I do not know what such things mean, in the script:
export HOME="$PWD"
Can someone interpret for me, what $PWD means?
export LD_LIBRARY_PATH="$PWD/lib/"
I understand that the script is going to get the .so files with that line, yes?
And can someone interpret the following line:
exec $# 2>/dev/null
What I am wondering is, where does the actual pdf get output? I did run the script. It did not throw any errors. However, I did not see a resulting PDF file.
Also, jockie's directions are not totally clear or defined enough. He says, "(some of them are symlinks)" under the list of .so files. Are such lines (in his list), the symlinks?:
lib/libX11.so.6 lib/libX11.so.6.2.0
Or am I mistaken? I was able to get all of them, so I don't know why they would be symlinks. The only thing is, that some of the versions are different. Do I need to delete the following files and make symlinks instead?:
lib/libX11.so.6
lib/libXau.so.6
lib/libxcb.so.1
lib/libXext.so.6
Should the shell script code be written differently, with Drupal in mind?
Thanks for reading and I hope someone can help!
...Finally, if anyone knows of a better solution, please share! Again, I appreciate the help!
...There does not seem to be a way, here on StackOverflow.com to notify jockie to check out this thread. I wish there was a way to write to them or notify them, so that they could clarify for them-self or contribute to this thread as well. If someone knows of a way, please let me know that too!

Resources