Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am running scripts via cron without issue but I have a need to run something similar with at. I am sending 2 arguments, XYZ and 1, to my script. My working cron line is
The script writes an output file in /home/user/dir/ and the script uses full, not relative, path definitions. I have tried a dozen different variations of my working cron line, as the user and as root, with no success and I've also searched high and low but I am finding it very hard to find any relevant information using "at" in searches...go figure.
What, exactly, have you tried? Show us the at command lines you entered and tell us what did (or didn't) happen.
"no success" doesn't give us much to go on to help.
I am running scripts via cron without issue but I have a need to run something similar with at.
Cron syntax (periodical) and at syntax (one time execution) have got nothing to do with each other, in most distributions they're even completely different daemons.
I was trying things doing "at now + 1 minute" and then entering commands, ENTER, then ctrl-d. However, after getting the echo "CMD" | at <execution time> syntax and it still was not working, I realized I had logged in as root and su to user but I was still in the /root directory...After opening a new session as user the recommended notation worked.
PEBKAC - Problem Exists Between Keyboard and Chair. I will hang my head in shame for 1 hour.
I was trying things doing "at now + 1 minute" and then entering commands, ENTER, then ctrl-d. However, after getting the echo "CMD" | at <execution time> syntax and it still was not working, I realized I had logged in as root and su to user but I was still in the /root directory...After opening a new session as user the recommended notation worked.
PEBKAC - Problem Exists Between Keyboard and Chair. I will hang my head in shame for 1 hour.
I've also heard ALNATKB -- A Loose Nut At The Keyboard.
I have developed the habit of using
Code:
su - user
when switching from root to a user. The minus (-) causes the the login to switch to the user's environment and home directory, which is what one wants most of the time in that situation.
I've even aliased (system-wide) su to su -, you normally always want to switch to the new user's home dir (and aliases, etc). So both going towards root as from root to another user ID.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.