Start Centos without cronjobs - cron

I've a very big problem. How I can startup ma centos server without the cronjobs defined in the crontab -e?
I've to disable temporally this feature because I can't login anymore in the server because there is an infinite loop in the sh file that start at the login.
I've to disable all cronjobs at startup, but I can't login in the server
Thanks
Davide

Once your server starts, try this command and make the necessary change to the crontab -e:
"/etc/init.d/crond stop" (Without quotes)
Once you use the command, I think your issue will be resolved.
If you using WHM for your server, then follow these steps to stop cronjobs:
1) Login to your control Panel.
2) Go to "Service Manager".
3) Uncheck "Cron Daemon" option.
4) Now, press on Save button.
If you still face any problem, report me so that I can assist you further.
Thanks,
Pratik Jajal

I resolved the problem:
I've insert the hard disk in another computer as external hard drive. After that I followed word par word the following link: http://pissedoffadmins.com/os/mount-unknown-filesystem-type-lvm2_member.html

You can open crontab -e and can delete each job which runs at the scheduled timeframe. I don't think your problem might be related to crontabs.
Will it be possible if you can share us the snapshots of your issue so that we can try our best to fix it?
Thanks,
Pratik Jajal

Related

How do I grant a cron job webcam access in Mac OSX Mojave?

In OSX Mojave, access to the camera is controlled by pop-up dialogs and the new System Preferences>>Security & Privacy>>Privacy>>camera panel, where apps can be granted (or denied) access to the camera.
I can grant "iterm2" access to the camera, which lets me run imagesnap from the commandline.
I use a cron job to capture a photograph of the cat bed every 60 seconds. This now fails, since upgrade to Mojave, because it does not have permission to access the camera. Is there any way I can give my cron job access? I don't get a pop-up dialog for a cron job.
Using an Automator application wrapper also works. Create the wrapper (run shell script), run in manually and grant it permission. Then the cron job can call the Automator app.
I hacked around this by using a wrapper script that indirects through Applescript to use iTerm, which does have permission, and have cron launch the wrapper.
#!/bin/bash
osascript << EOF 2>&1 | grep -v "window id"
tell application "iTerm"
create window with default profile command "/path/to/capturescript"
end tell
EOF
FWIW - Mojave broke this further, and the Automator app broke.
I lost a lot of time fiddling with it, and then gave up. It seems the security of camera devices changed again. My time is expensive and raspberry pis are cheap; I connected the camera to a pi and now access it from cron with "ssh pi fswebcam - > output.jpg" which works flawlessly.
Open Automator on Mac.
Click New Document.
Choose Application.
In search bar search for Run Shell Script and add to application with click.
Add code for running your desired script (like you would run the script from shell).
On top right click Run.
Allow access to camera.
With installed cronjob you should be fine.

systemd Force Service to Complete Before Proceeding in CentOS 7.1

I have a service that needs to complete before I can let Linux start up continue. I'd rather not have to specify each service and target in a Before= statement in my .service files. In SysVInit, I just specified the start number I wanted with chkconfig.
I have tried defining a foo.target and a foo.service and set it with require= and after= for network.target (I need networking) as well as before=multi-user.target. This doesn't seem to be working. I have set up the foo.target.wants directory to have a symlink to foo.service.
I have tried turning on debug in system.conf, to see what's wrong and had disastrous results.
Any help would be appreciated.
I finally got everything working the way I wanted. It's not pretty, but...
I changed the systemd default to a special target that wants what services are needed and runs my script at the end. At the end of my script, systemctl isolate multi-user is issued. I've verified that this works as desired.

openerp-server goes down, and stops functioning

I've installed Odoo/OpnnERP, and I've put the openerp-server daemon in /etc/init.d to get it started automatically on Ubuntu startup. It gets started normally on every reboot and works fine. But sometimes it goes down automatically, I don't know any pattern when it goes down, and I also can't see any reason in the log file (/var/log/openerp/openerp-server.log). It just goes down without any logs. When I find it down, I have to reboot manually to get it started again.
Any help on spotting the issue which causes openerp-server to stop automatically without any logs?
Thanks,
Abdul
I have Odoo under a DO droplet and all I did was upgrading the droplet, that's it!
Just found an answer to the above issue. Here is the solution

New lines are not permitted in crontab entries

I am trying to set a crontab in cPanel but it always show an error:
New lines are not permitted in crontab entries.
Note: I am trying to do it from cPanel web interface.
If you are using a custom cPanel theme this may be caused due to an issue with a recent cPanel update which forces a security token. If you examine the url after hitting the submit button you should notice that the link is missing the security token (cpsess0000000000, for example).
In the past you could get around this by disabling the security token in WHM however this newest release by cPanel has prevented this from being disabled. I would recommend going back to the default theme(x3) and trying again.
I recently ran into this issue myself and am currently building a new cPanel interface for all of my servers. I suppose that it's for the best though. I've been putting this on the back burner for a while.
Just check the contents in "/var/spool/cron/username"
it should be having a special character or a wrong format which is causing the issue from file being edited via the cPanel interface
I faced the same issue, once editing crontab using PHP script, I was no longer able to edit cron jobs from cPanel, and problem was in the windows/linux line breaks in the script:
shell_exec('echo "' . implode("\r\n", $array) . '" | crontab -');
So, replacing \r\n to \n fixed my issue.

How do I logout from a computer using shell?

How can I log out of my computer using shell such the log-in window appears again?
I need this functionality in one my Linux script.
Update:
I want to replicate the code working behind the Logout button of my Ubuntu.
Desktop Enviroment being used: GNOME
I think this does the job:
gnome-session-save --logout
Also, take a look at the --help output, maybe you want to use the --force-logout option.
Usage:
gnome-session-save [OPTION...]
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options
Application Options:
--logout Log out
--force-logout Log out, ignoring any existing inhibitors
--logout-dialog Show logout dialog
--shutdown-dialog Show shutdown dialog
--gui Use dialog boxes for errors
--display=DISPLAY X display to use
Your question is a bit vague. Are you trying to log out of a graphical session of a desktop environment (such as KDE/Gnome), as if the user clicked on "log off"?
Then you need to find out if/how the desktop environment supports scripting to log out. On KDE for example you can use kquitapp.
Try restarting the display manager using one of the following, depending one which one you're using. You'll obviously have to have the proper permissions.
/etc/init.d/xdm restart
/etc/init.d/kdm restart
/etc/init.d/gdm restart
It's a bit of a hack, but the way that screen's power detach does this is to determine its parent pid and send it a SIGHUP. (Clarification: This closes only the shell, so only works if you're running from a console - not a graphical login - so may not be what you're looking for.)
Type in terminal
gnome-session-quit
or
pkill -kill -u {Username}

Resources