Why does crontab throw error: "illegal action" - cron

I entered some cron jobs, everything saved correctly (jobs added)
I then went back and typed crontab -e to adjust something and I got a message: "illegal action" I also get this when typing crontab --help or crontab
Wow...now when I open my terminal, I get:
Could not open a new pseudo-tty.

crontab -e tries to use the editor specified in your environment variable named VISUAL (or missing that in the one named EDITOR). What do you have in those variables? It's impossible for us to guess, but maybe it's some weird value causing the "illegal action" message and/or something that consumes all pseudo-ttys, causing the rest of the problems you report.
crontab --help, to me, says "illegal option" (not "illegal action"!), but that's on my Darwin machine -- you don't deign to mention what version of Unix-oid system you're using and, again, it's impossible to guess from your scant input!-)

Thanks for your input :). I restarted my computer and everything is working again. Go fig...

Related

Cding into directory hangs terminal

I am encountering a really weird issue when trying to "cd" into a specific directory (e.g. directory_A) along a path. Whenever I try to "cd", my linux terminal immediately hangs for at least 1hr. Upon entering successfully, the terminal is completely frozen and I cannot run any commands within the shell.
Additionally, while exiting the "cd" command during execution through "ctrl-c" does kill the "cd" call, it becomes impossible to run any additional command within the shell (i.e. "ls/cd/etc.." into directory_B causes the terminal to hang again). This happens despite the fact that cding into directory_B (without first trying to cd into directory A) causes no issues whatsoever. It appears that trying to enter directory_A at all causes immediate failure of the shell somehow.
What is more is that "lsing" directory A from its parent dir causes no issues. I can see all the files (and even open them! - e.g. through "vim directory_A/foo.txt), but "cding" causes massive problems.
I'm not sure if I just have the wrong keyword searches, but I haven't been able to find similar issues - though I acknowledge I am far from an expert with these things.
Has anyone seen such an issue before? Or may know potentially where to search for potential answers?
I'd be happy to provide any other information as well - thanks very much for any help/advice you may have!
A) type alias | grep cd to see if its aliased, or type cd to check wether its been re-defined as a function.
B) start a new shell without startup file: bash --noprofile --norc
C) use a different shell: sh, or whatever

Alter Behavior of xdg-open

I use the command xdg-open quite a lot in my Ubuntu Linux terminal. However, two things irk me:
Is it possible to suppress the error messages?
Is it possible to get the command to always complete? (That is, not continue running, so that I have another "new line" in my terminal).
I realize 2 may not be possible, because of the way the program works, but I imagine 1 is.
First one is easy. Just
alias xdg-open="xdg-open 2>/dev/null"
If you want it permanently, just add that line to ~/.bashrc file.
I recommend you to think twice if you want to become blind to errors, though.
The second one is quite confusing to me. xdg-open shouldn't be intereactive. In my computer (Debian sid) xdg-open execs the command and ends, even if the command itself has not ended (ie: you have not closed the application opened for the URL). I think this should be the behaviour of xdg-open on any platform (it's supposed to work exactly the same way on any XDG system, that's its very purpose).
Anyway, for any command you launch in a shell, if you want it to be non-interactive, that is, to allow to enter commands even if the previous one hasn't finished, you just attach "&" to the end of it. Example:
# prompt is not shown until you close the calculator
$ gnome-calculator
# prompt is shown right after opening calculator and you can
# work on the shell even if you don't close it
$ gnome-calculator &
I maybe late for the answer, but I got exactly the same problem like you have / had.
I tried to start a URL with xdg-open, my default browser is firefox, and not xdg-open but firefox started with an error:
[user#user-pc ~]$ xdg-open https://www.google.de # the page opens fine, but firefox had an error
[user#user-pc ~]$
(process:3783): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
# needed to press enter here
xdg-open closed fine but the firefox error stayed and I need to press enter to get the bash moving.
To get along this problem I called xdg-open within a new shell putting those output to /dev/null:
bash -c "xdg-open https://www.google.de" 2> /dev/null
The page opened fine, no error shown – rather nothing has been shown. And no need to press enter.

How can I revert my last choice on terminal if it shows > symbol?

I'll be glad if someone can fix the title to be more appropriate since I'm pretty new to terminal.
I have an issue with terminal. Once I execute a command, if it goes to the next line, I can't close it or revert it. I assume it starts the executable or asks for more parameters using >
For example:
//Windows Machine
vagrant up
//Vagrant Instance Unix Machine
$ git
>
>
>
> ... it goes on like this, I can't close > so I can't execute other commands
The only solution on fixing is restarting the terminal (which means I need to restart Vagrant instance)
It happens on some commands only - not all, so I don't know what makes a difference.
For example, executing composer, I get information about Composer and terminal goes back to main state. However, if I execute things like php, git, mysql, > symbol appears and I can't return from there.
So, two basic questions;
What causes this?
How can I terminate the current command to go back main state?
Any help would be greatly appreciated.
Ps. I use both windows terminal and unix terminal and this issue happens on both.
Normally you'll see a > prompt if you've entered a command that's syntactically incomplete, for example if there's a unterminated string literal:
$ echo 'hello
> '
hello
$
It means that the shell is waiting for you to type the rest of the command, or at least enough of it to make for something that's not a syntax error.
In this example, the default prompt, $PS1, is '$ ', and the secondary prompt, $PS2, is '> '. Read the documentation for your shell (probably bash) for more information.
You can cancel the current command and get back to your primary prompt for a new command by typing Control-C.
This is all about the behavior of your shell; it has nothing to do with your terminal (almost certainly a terminal emulator), which merely provides a GUI for your shell to run in.

Upstart unknown job error on amazon server

I am trying to deploy my first upstart job to reload my server if it crashes but no matter what I put into the job it gives error of unknown job. Even if I have the job doing nothing only comments.
This is the job. only few lins. I'm using emacs
# comment
description "golf"
script
export HOME="/root"
exec sudo -u
ubuntu /usr/local/bin/node
/home/ubuntu/golf/node/lib/db-server1.js 2>&1
>> /var/log/golf.log
end script
The paths are correct but I always get error unknown job Golf, even if I remove everything. Thanks for any advise
Most likely, the service name does not match what you expect. Most notably, the upper-case G is quite unusual. Are you certain that there's a service definition in /etc/init.d/Golf.conf, as opposed to /etc/init.d/golf.conf (note the lower-case g)?

Crontab opens on blank page, cannot save

I am really not familiar with Linux, and only started using it recently, so be patient with me.
I am trying to control a camera on regular intervals through a script that is called upon in the crontab. When I start up the computer, I can open the crontab file, edit and save, and everything is executed correctly. So my script is fine. (btw, I use gedit as editor)
However, I can never open crontab a second time, unless I reboot the computer first.
This is what happens: I type crontab -e in terminal and I get a blank page. (Usually, crontab shows first a whole explanation as comments, after which you type your actual commands.) When I then type my commands and try to save the file (/tmp/crontab.something), I get the following message: could not find the file /tmp/crontqb.something/crontab. Please check that you typed the location correctly and try again.
After I then closed the file without saving, terminal says "no modification made", which is fair enough..
When I try: crontab -l, I do get the correct content of crontab in terminal.
I don't know if this is relevant, but when I try sudo crontab -e, I get " no crontab for root. Using an empty one. 888" But he doesn't open anything and I get no new input line in the terminal.
After I reboot the computer, crontab -e works fine again, but only once..
Any help is really appreciated!
Sarah

Resources