How to install cron with debugging enabled? - cron

I like to debug a crontabs file which shows unclear behaviour and cron has the -x flag. However, running cron -f -x proc gives me
this program was compiled without debugging enabled
It is a debian system. Any advice on how to install a cron package with debugging enabled is highly appreciated. Could not find any advice online yet.

Related

Run Google Assistant SDK on boot (Raspbian)

I am currently trying to get a cron job working, so that the google assistant starts automatically after boot. For that I created this cron job which executes on reboot.
SHELL=/bin/sh
PATH=/usr/bin:/bin:/home/pi/Desktop:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#Reboot lxterminal -t "Google Assistant" -e /bin/bash /home/pi/Desktop/init.sh
lxterminal will open a window with google assistant running within.
Here is my full cron job:
#!/bin/bash
SHELL=/bin/sh
PATH=/usr/bin:/bin:/home/pi/Desktop:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
source /home/pi/env/bin/activate
python3 /home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/grpc/pushtotalk.py
I already tried answers from similar problems and even specified the path variable for cron, but it still won't work for me. The script isn't the fault, when I execute it manually it runs fine.
The problem wasn't with cron, though I settled for using a systemd service instead.
What I didn't know was, that Lxterminal needed a initalized screen to work and due to the script running on boot it wasn't.
This is an easy fix. Either add an delay of 30 Seconds or other values, depending on your system, to the beginning of your script or simulate the display beeing initalized already with export DISPLAY=:1

Centos7 unable to run #reboot command

I am not able to run reboot commands on my CentOS 7 machine.
For example I've created a script: /home/usr/myscript.sh (marked executable) with:
echo "hello world" > example.txt
When Im trying to run the script from terminal everything works good.
I tried to start the script on reboot at the end of the file:
nano /etc/crontab
I added:
#reboot /home/usr/myscript.sh
and on restart, nothing happen.
I also tried to edit file:
crontab -e
its looks like a new generated file, I've typed my command, and again nothing happend.
How can I run a command on CentOS at reboot?
I tried to insert that command on my Ubuntu machine, and everything was good and worked properly.
Anyone can advise on different way (maybe 3rd party program) that will help me to manage the reboot jobs?
Thanks for the help.
BTW, its might be duplicate, but I cant find any answer that helped me
In CentOS/RHEL 7, the systemctl utility replaces some older power management commands used in previous versions. The table below compares the older and new equivalent systemctl commands. The old commands listed in the table still exist for compatibility reasons.
Older Command systemctl equivalent Description
halt systemctl halt Halts the system
poweroff systemctl poweroff Powers off the system
reboot systemctl reboot Restarts the system
pm-suspend systemctl suspend Suspends the system
pm-hibernate systemctl hibernate Hibernates the system
pm-suspend-hybrid systemctl hybrid-sleep Hibernates and suspends the system
I was able to reach this out by adding a crontab file for my user.
with the following command:
crontab -u usrname filename
That allow me to run my scripts.
Thanks !

Error! Some required system tools for security patches magento

Error! Some required system tools, that are utilized in this sh script, are not installed:
Tool(s) "patch" is(are) missed, please install it(them).
is there any thing I am missing?
EDIT:
I am running patch for magento version 1.7.0.2
PATCH_SUPEE-2677_EE_1.13.0.2_v2.sh file is showing this error.
I got the solutions. Here is my method. I hope it will help the others too
Use the attached patch file and upload the same in root folder of magento
The file is having extension .sh
use putty or any other command line tool to access the shell commands.
Go the path where the file is available. i.e.
cd /var/www/html/magento
then run the command
sh PATCH_SUPEE-2677_EE_1.13.0.2_v2.sh
If error comes then try to use the command
yum install patch
again run the sh command
Checking if patch can be applied/reverted successfully...
Patch was applied/reverted successfully.
The process is complete. to make the impact
Once that is done, refresh the cache in the Admin under "System > Cache Management" so that the changes will be reflected. We highly recommend you test all patches in a test environment before taking them live.

Can Jenkins monitor cron jobs that I run using crontab?

I have written some cron jobs using the crontab feature on my ubuntu. Can I use Jenkins to monitor these jobs?
Edit 1: I have Jenkins already installed on my local machine: localhost:8080. So right now, I have cronjobs running on crontab. I cannot create a new job on Jenkins and run them on Jenkins's shell because of certain requirements.
Following Pragmatic's solution, I looked at https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs and tried to sudo apt-get install jenkins-external-tool-monitor, but I am getting: E: Couldn't find package jenkins-external-tool-monitor. Any work arounds?
Edit 2: I have figured it out. Very Important: I tried to set this up using jenkins-core-1.47*.jar file, and it didnt work. It did work with jenkins-core-1.466.jar. So if you are using some .jar file, stop jenkins, replace it with a jenkins.war that corresponds to jenkins-core-1.466.jar and start jenkins after. That should work!
Yes, you can do that!!
Have a look at this link: Monitoring external jobs.
I could have explained the whole method here itself but the details in the question were minimal.
Hope this helps you.
Possible...See this
https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs
As others have stated above, follow: https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs
Then I started getting this ugly error: https://issues.jenkins-ci.org/browse/JENKINS-14107
If you face this problem as well, replace the current jenkins.war file with one from version 1.466. That is the one that worked for me. Before I replaced the war file, I stopped the jenkins server by : /etc/init.d/jenkins -stop and then replaced the war file and then started the server: /etc/init.d/jenkins -start
An alternative approach is to use an instance of Jenkins to replace your cron jobs entirely.
See:
Drop that cron; use Hudson instead
Replace Local Cron With Jenkins

Why can't I get Openfire to start?

I am having trouble getting Openfire to work. I done the following:
[root#jiaoyou logs]# which java
/usr/bin/java
and I've run this command:
ln -s /usr/bin/java /opt/openfire/jre/bin/java
but when starting Openfire, it still says:
cannot run command `/opt/openfire/jre/bin/java': No such file or directory
It seems like a permission issue, but I don't know how to fix that.
This was solved for me, in CentOS6 64bit, using the following commands:
cd /opt/openfire/jre/bin
cp java java.bak
rm java
ln -s /usr/bin/java java
service openfire start
If you're on a 64-bit machine, you should install zlib package for 32-bit architectures.
For Redhat/Centos, use:
yum install -y zlib.i686
/usr/bin/java is just a shell script that runs the actual binary. If you don't have the JAVA_HOME environment variable set correctly, it might not be able to locate the binary if invoked through a symlink like that.
Another thing to keep in mind is that some distros of Linux put /usr/bin/java in place even though you haven't installed the Sun JRE. Don't bother trying to use the GNU version of Java, it's rubbish. Do you know if the Sun JRE is installed or not? What does "java -version" tell you?
I think the correct answer is using the right command to start openfire. I have found that "service openfire start" actually doesn't work.
I attempted the above mentioned method of removing the java executable from opt/openfire/jre/bin and all that did was force me into reconfiguring all of my current openfire settings. Thank god I made that java.bak file.
I believe the proper method to stop|start|restart is from /opt/openfire/bin and run ./openfire start or from anywhere "/opt/openfire/bin/openfire start"
At least that's what worked for me.

Resources