Send Email as Root *Before* User Login?












1















I'm not sure I'm on the right forum for this, but I found some hints in another thread that suggest the knowledge base might work out here.



I've got a startup script running as root (managed by Lingon X) on macOS X High Sierra (latest as of 22 December 2018); the script is intended to do two things; one, log the (approximate) startup/restart time to a local file (works fine); and send an email to an outside address before a user login (works only if run manually after login).



(Note: I have a second script that logs/emails on login/logout; that all works fine, but I need to know when a remote machine is restarted and then, most likely, is stalled at the user login screen.)



I have /usr/lib/postfix/master running as root; and I tried naming the notification script with an alpha scheme to (presumably?) launch after it; I further tried sleep options to allow time for postfix to launch and accept new jobs.



No such jobs ever execute, nor do they accumulate in mailq



I played with trying to check for and sending only if postfix is running; it confirms that postfix is indeed running, gives me a PID for the log, but still won't send or at least place in the queue.



What service am I missing that needs launching beforehand? Or is there a missing element to sending email as root without a user environment?



Thanks for any help; if I'm in the wrong place, let me know, please.










share|improve this question













migrated from security.stackexchange.com Dec 29 '18 at 14:29


This question came from our site for information security professionals.











  • 2





    The process may be running, but that doesn't mean the service is ready. It could be that if you delay your notification script that will give enough time for postfix to initialize.

    – Daisetsu
    Dec 23 '18 at 7:35











  • Your suggestion is appreciated; I mentioned in my post attempting to sleep the script -- by as much as 40 seconds -- with no apparent difference. The machine can fully boot to Desktop in under 30 seconds, and, if automatic login is enabled, it will send the login email well before that, but never will send the startup email, though it has root permissions.

    – Frederico
    Dec 23 '18 at 19:38
















1















I'm not sure I'm on the right forum for this, but I found some hints in another thread that suggest the knowledge base might work out here.



I've got a startup script running as root (managed by Lingon X) on macOS X High Sierra (latest as of 22 December 2018); the script is intended to do two things; one, log the (approximate) startup/restart time to a local file (works fine); and send an email to an outside address before a user login (works only if run manually after login).



(Note: I have a second script that logs/emails on login/logout; that all works fine, but I need to know when a remote machine is restarted and then, most likely, is stalled at the user login screen.)



I have /usr/lib/postfix/master running as root; and I tried naming the notification script with an alpha scheme to (presumably?) launch after it; I further tried sleep options to allow time for postfix to launch and accept new jobs.



No such jobs ever execute, nor do they accumulate in mailq



I played with trying to check for and sending only if postfix is running; it confirms that postfix is indeed running, gives me a PID for the log, but still won't send or at least place in the queue.



What service am I missing that needs launching beforehand? Or is there a missing element to sending email as root without a user environment?



Thanks for any help; if I'm in the wrong place, let me know, please.










share|improve this question













migrated from security.stackexchange.com Dec 29 '18 at 14:29


This question came from our site for information security professionals.











  • 2





    The process may be running, but that doesn't mean the service is ready. It could be that if you delay your notification script that will give enough time for postfix to initialize.

    – Daisetsu
    Dec 23 '18 at 7:35











  • Your suggestion is appreciated; I mentioned in my post attempting to sleep the script -- by as much as 40 seconds -- with no apparent difference. The machine can fully boot to Desktop in under 30 seconds, and, if automatic login is enabled, it will send the login email well before that, but never will send the startup email, though it has root permissions.

    – Frederico
    Dec 23 '18 at 19:38














1












1








1








I'm not sure I'm on the right forum for this, but I found some hints in another thread that suggest the knowledge base might work out here.



I've got a startup script running as root (managed by Lingon X) on macOS X High Sierra (latest as of 22 December 2018); the script is intended to do two things; one, log the (approximate) startup/restart time to a local file (works fine); and send an email to an outside address before a user login (works only if run manually after login).



(Note: I have a second script that logs/emails on login/logout; that all works fine, but I need to know when a remote machine is restarted and then, most likely, is stalled at the user login screen.)



I have /usr/lib/postfix/master running as root; and I tried naming the notification script with an alpha scheme to (presumably?) launch after it; I further tried sleep options to allow time for postfix to launch and accept new jobs.



No such jobs ever execute, nor do they accumulate in mailq



I played with trying to check for and sending only if postfix is running; it confirms that postfix is indeed running, gives me a PID for the log, but still won't send or at least place in the queue.



What service am I missing that needs launching beforehand? Or is there a missing element to sending email as root without a user environment?



Thanks for any help; if I'm in the wrong place, let me know, please.










share|improve this question














I'm not sure I'm on the right forum for this, but I found some hints in another thread that suggest the knowledge base might work out here.



I've got a startup script running as root (managed by Lingon X) on macOS X High Sierra (latest as of 22 December 2018); the script is intended to do two things; one, log the (approximate) startup/restart time to a local file (works fine); and send an email to an outside address before a user login (works only if run manually after login).



(Note: I have a second script that logs/emails on login/logout; that all works fine, but I need to know when a remote machine is restarted and then, most likely, is stalled at the user login screen.)



I have /usr/lib/postfix/master running as root; and I tried naming the notification script with an alpha scheme to (presumably?) launch after it; I further tried sleep options to allow time for postfix to launch and accept new jobs.



No such jobs ever execute, nor do they accumulate in mailq



I played with trying to check for and sending only if postfix is running; it confirms that postfix is indeed running, gives me a PID for the log, but still won't send or at least place in the queue.



What service am I missing that needs launching beforehand? Or is there a missing element to sending email as root without a user environment?



Thanks for any help; if I'm in the wrong place, let me know, please.







root postfix






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 23 '18 at 6:35







Frederico











migrated from security.stackexchange.com Dec 29 '18 at 14:29


This question came from our site for information security professionals.






migrated from security.stackexchange.com Dec 29 '18 at 14:29


This question came from our site for information security professionals.










  • 2





    The process may be running, but that doesn't mean the service is ready. It could be that if you delay your notification script that will give enough time for postfix to initialize.

    – Daisetsu
    Dec 23 '18 at 7:35











  • Your suggestion is appreciated; I mentioned in my post attempting to sleep the script -- by as much as 40 seconds -- with no apparent difference. The machine can fully boot to Desktop in under 30 seconds, and, if automatic login is enabled, it will send the login email well before that, but never will send the startup email, though it has root permissions.

    – Frederico
    Dec 23 '18 at 19:38














  • 2





    The process may be running, but that doesn't mean the service is ready. It could be that if you delay your notification script that will give enough time for postfix to initialize.

    – Daisetsu
    Dec 23 '18 at 7:35











  • Your suggestion is appreciated; I mentioned in my post attempting to sleep the script -- by as much as 40 seconds -- with no apparent difference. The machine can fully boot to Desktop in under 30 seconds, and, if automatic login is enabled, it will send the login email well before that, but never will send the startup email, though it has root permissions.

    – Frederico
    Dec 23 '18 at 19:38








2




2





The process may be running, but that doesn't mean the service is ready. It could be that if you delay your notification script that will give enough time for postfix to initialize.

– Daisetsu
Dec 23 '18 at 7:35





The process may be running, but that doesn't mean the service is ready. It could be that if you delay your notification script that will give enough time for postfix to initialize.

– Daisetsu
Dec 23 '18 at 7:35













Your suggestion is appreciated; I mentioned in my post attempting to sleep the script -- by as much as 40 seconds -- with no apparent difference. The machine can fully boot to Desktop in under 30 seconds, and, if automatic login is enabled, it will send the login email well before that, but never will send the startup email, though it has root permissions.

– Frederico
Dec 23 '18 at 19:38





Your suggestion is appreciated; I mentioned in my post attempting to sleep the script -- by as much as 40 seconds -- with no apparent difference. The machine can fully boot to Desktop in under 30 seconds, and, if automatic login is enabled, it will send the login email well before that, but never will send the startup email, though it has root permissions.

– Frederico
Dec 23 '18 at 19:38










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388751%2fsend-email-as-root-before-user-login%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388751%2fsend-email-as-root-before-user-login%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

When does type information flow backwards in C++?

Grease: Live!